Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
d47cdc3c
Commit
d47cdc3c
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
fix changing passwords
parent
5a26640f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
settings/ajax/changepassword.php
+12
-13
12 additions, 13 deletions
settings/ajax/changepassword.php
with
12 additions
and
13 deletions
settings/ajax/changepassword.php
+
12
−
13
View file @
d47cdc3c
...
...
@@ -6,33 +6,32 @@ require_once('../../lib/base.php');
$l
=
new
OC_L10N
(
'settings'
);
// We send json data
header
(
"Content-Type: application/jsonrequest"
);
header
(
"Content-Type: application/jsonrequest"
);
// Check if we are a user
if
(
!
OC_User
::
isLoggedIn
()){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Authentication error"
)
)));
if
(
!
OC_User
::
isLoggedIn
()){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Authentication error"
)
)));
exit
();
}
// Get data
if
(
!
isset
(
$_POST
[
"password"
]
)
&&
!
isset
(
$_POST
[
"oldpassword"
]
)){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"You have to enter the old and the new password!"
)
)));
if
(
!
isset
(
$_POST
[
"password"
])
&&
!
isset
(
$_POST
[
"oldpassword"
])){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"You have to enter the old and the new password!"
)
)));
exit
();
}
// Check if the old password is correct
if
(
!
OC_User
::
checkPassword
(
$_SESSION
[
"user_id"
],
$_POST
[
"oldpassword"
]
)){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Your old password is wrong!"
)
)));
if
(
!
OC_User
::
checkPassword
(
$_SESSION
[
"user_id"
],
$_POST
[
"oldpassword"
])){
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Your old password is wrong!"
))));
exit
();
}
// Change password
if
(
OC_User
::
setPassword
(
$_SESSION
[
"user_id"
],
$_POST
[
"password"
]
)){
echo
json_encode
(
array
(
"status"
=>
"success"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Password changed"
)
)));
OC_Crypt
::
changekeypasscode
(
$_POST
[
"password"
])
{
}
else
{
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Unable to change password"
)
)));
if
(
OC_User
::
setPassword
(
$_SESSION
[
"user_id"
],
$_POST
[
"password"
])){
echo
json_encode
(
array
(
"status"
=>
"success"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Password changed"
))));
OC_Crypt
::
changekeypasscode
(
$_POST
[
"password"
]);
}
else
{
echo
json_encode
(
array
(
"status"
=>
"error"
,
"data"
=>
array
(
"message"
=>
$l
->
t
(
"Unable to change password"
))));
}
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment