|
@@ 45-49 (lines=5) @@
|
| 42 |
|
$password = isset($_POST['personal-password']) ? $_POST['personal-password'] : null; |
| 43 |
|
$oldPassword = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : ''; |
| 44 |
|
|
| 45 |
|
if (!\OC_User::checkPassword($username, $oldPassword)) { |
| 46 |
|
$l = \OC::$server->getL10NFactory()->get('settings'); |
| 47 |
|
\OC_JSON::error(["data" => ["message" => $l->t("Wrong password")]]); |
| 48 |
|
exit(); |
| 49 |
|
} |
| 50 |
|
if ($oldPassword === $password) { |
| 51 |
|
$l = \OC::$server->getL10NFactory()->get('settings'); |
| 52 |
|
\OC_JSON::error(["data" => ["message" => $l->t("The new password can not be the same as the previous one")]]); |
|
@@ 50-54 (lines=5) @@
|
| 47 |
|
\OC_JSON::error(["data" => ["message" => $l->t("Wrong password")]]); |
| 48 |
|
exit(); |
| 49 |
|
} |
| 50 |
|
if ($oldPassword === $password) { |
| 51 |
|
$l = \OC::$server->getL10NFactory()->get('settings'); |
| 52 |
|
\OC_JSON::error(["data" => ["message" => $l->t("The new password can not be the same as the previous one")]]); |
| 53 |
|
exit(); |
| 54 |
|
} |
| 55 |
|
try { |
| 56 |
|
if (!is_null($password) && \OC_User::setPassword($username, $password)) { |
| 57 |
|
\OC::$server->getUserSession()->updateSessionTokenPassword($password); |