|
@@ 147-151 (lines=5) @@
|
| 144 |
|
\OC_JSON::error(['data' => [ |
| 145 |
|
'message' => $l->t('Please provide an admin recovery password; otherwise, all user data will be lost.') |
| 146 |
|
]]); |
| 147 |
|
} elseif ($recoveryEnabledForUser && ! $validRecoveryPassword) { |
| 148 |
|
\OC_JSON::error(['data' => [ |
| 149 |
|
'message' => $l->t('Wrong admin recovery password. Please check the password and try again.') |
| 150 |
|
]]); |
| 151 |
|
} else { // now we know that everything is fine regarding the recovery password, let's try to change the password |
| 152 |
|
$result = \OC_User::setPassword($username, $password, $recoveryPassword); |
| 153 |
|
if (!$result && $recoveryEnabledForUser) { |
| 154 |
|
\OC_JSON::error([ |
|
@@ 159-161 (lines=3) @@
|
| 156 |
|
"message" => $l->t("Backend doesn't support password change, but the user's encryption key was successfully updated.") |
| 157 |
|
] |
| 158 |
|
]); |
| 159 |
|
} elseif (!$result && !$recoveryEnabledForUser) { |
| 160 |
|
\OC_JSON::error(["data" => ["message" => $l->t("Unable to change password" )]]); |
| 161 |
|
} else { |
| 162 |
|
self::sendNotificationMail($username); |
| 163 |
|
\OC_JSON::success(["data" => ["username" => $username]]); |
| 164 |
|
} |