Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
8104a4e2
Commit
8104a4e2
authored
Nov 06, 2014
by
Bjoern Schiessle
Browse files
check if the provided password is really the current log-in password
parent
33294927
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/files_encryption/ajax/updatePrivateKeyPassword.php
View file @
8104a4e2
...
...
@@ -18,6 +18,7 @@ use OCA\Encryption;
$l
=
\
OC
::
$server
->
getL10N
(
'core'
);
$return
=
false
;
$errorMessage
=
$l
->
t
(
'Could not update the private key password.'
);
$oldPassword
=
$_POST
[
'oldPassword'
];
$newPassword
=
$_POST
[
'newPassword'
];
...
...
@@ -26,6 +27,11 @@ $view = new \OC\Files\View('/');
$session
=
new
\
OCA\Encryption\Session
(
$view
);
$user
=
\
OCP\User
::
getUser
();
// check new password
$passwordCorrect
=
\
OCP\User
::
checkPassword
(
$user
,
$newPassword
);
if
(
$passwordCorrect
!==
false
)
{
$proxyStatus
=
\
OC_FileProxy
::
$enabled
;
\
OC_FileProxy
::
$enabled
=
false
;
...
...
@@ -42,14 +48,22 @@ if ($decryptedKey) {
$session
->
setPrivateKey
(
$decryptedKey
);
$return
=
true
;
}
}
else
{
$result
=
false
;
$errorMessage
=
$l
->
t
(
'The old password was not correct, please try again.'
);
}
\
OC_FileProxy
::
$enabled
=
$proxyStatus
;
}
else
{
$result
=
false
;
$errorMessage
=
$l
->
t
(
'The current log-in password was not correct, please try again.'
);
}
// success or failure
if
(
$return
)
{
$session
->
setInitialized
(
\
OCA\Encryption\Session
::
INIT_SUCCESSFUL
);
\
OCP\JSON
::
success
(
array
(
'data'
=>
array
(
'message'
=>
$l
->
t
(
'Private key password successfully updated.'
))));
}
else
{
\
OCP\JSON
::
error
(
array
(
'data'
=>
array
(
'message'
=>
$
l
->
t
(
'Could not update the private key password. Maybe the old password was not correct.'
)
)));
\
OCP\JSON
::
error
(
array
(
'data'
=>
array
(
'message'
=>
$
errorMessage
)));
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment