Skip to content
Snippets Groups Projects
Commit 18a2c48c authored by Christopher Schäpers's avatar Christopher Schäpers
Browse files

Translate errormsgs in settings/changepassword/controller

parent 18da2f9c
No related branches found
No related tags found
No related merge requests found
...@@ -69,19 +69,27 @@ class Controller { ...@@ -69,19 +69,27 @@ class Controller {
} }
if ($recoveryEnabledForUser && $recoveryPassword === '') { if ($recoveryEnabledForUser && $recoveryPassword === '') {
\OC_JSON::error(array('data' => array('message' => 'Please provide a admin recovery password, otherwise all user data will be lost'))); $l = new \OC_L10n('settings');
\OC_JSON::error(array('data' => array(
'message' => $l->t('Please provide an admin recovery password, otherwise all user data will be lost')
)));
} elseif ($recoveryEnabledForUser && ! $validRecoveryPassword) { } elseif ($recoveryEnabledForUser && ! $validRecoveryPassword) {
\OC_JSON::error(array('data' => array('message' => 'Wrong admin recovery password. Please check the password and try again.'))); $l = new \OC_L10n('settings');
\OC_JSON::error(array('data' => array(
'message' => $l->t('Wrong admin recovery password. Please check the password and try again.')
)));
} else { // now we know that everything is fine regarding the recovery password, let's try to change the password } else { // now we know that everything is fine regarding the recovery password, let's try to change the password
$result = \OC_User::setPassword($username, $password, $recoveryPassword); $result = \OC_User::setPassword($username, $password, $recoveryPassword);
if (!$result && $recoveryPasswordSupported) { if (!$result && $recoveryPasswordSupported) {
$l = new \OC_L10n('settings');
\OC_JSON::error(array( \OC_JSON::error(array(
"data" => array( "data" => array(
"message" => "Back-end doesn't support password change, but the users encryption key was successfully updated." "message" => $l->t("Back-end doesn't support password change, but the users encryption key was successfully updated.")
) )
)); ));
} elseif (!$result && !$recoveryPasswordSupported) { } elseif (!$result && !$recoveryPasswordSupported) {
\OC_JSON::error(array("data" => array( "message" => "Unable to change password" ))); $l = new \OC_L10n('settings');
\OC_JSON::error(array("data" => array( $l->t("message" => "Unable to change password" ) )));
} else { } else {
\OC_JSON::success(array("data" => array( "username" => $username ))); \OC_JSON::success(array("data" => array( "username" => $username )));
} }
...@@ -91,7 +99,8 @@ class Controller { ...@@ -91,7 +99,8 @@ class Controller {
if (!is_null($password) && \OC_User::setPassword($username, $password)) { if (!is_null($password) && \OC_User::setPassword($username, $password)) {
\OC_JSON::success(array('data' => array('username' => $username))); \OC_JSON::success(array('data' => array('username' => $username)));
} else { } else {
\OC_JSON::error(array('data' => array('message' => 'Unable to change password'))); $l = new \OC_L10n('settings');
\OC_JSON::error(array('data' => array('message' => $l->t('Unable to change password'))));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment