Merge pull request #5404 from nextcloud/use-translated-hint-insteadof-english-error

Use translated Hint instead of english error on password policy
This commit is contained in:
blizzz 2017-07-05 22:18:49 +02:00 committed by GitHub
commit 75f97852b4

View file

@ -33,6 +33,7 @@ namespace OC\Settings\Controller;
use OC\Accounts\AccountManager;
use OC\AppFramework\Http;
use OC\ForbiddenException;
use OC\HintException;
use OC\Settings\Mailer\NewUserMailHelper;
use OC\Security\IdentityProof\Manager;
use OCP\App\IAppManager;
@ -423,6 +424,9 @@ class UsersController extends Controller {
$user = $this->userManager->createUser($username, $password);
} catch (\Exception $exception) {
$message = $exception->getMessage();
if ($exception instanceof HintException && $exception->getHint()) {
$message = $exception->getHint();
}
if (!$message) {
$message = $this->l10n->t('Unable to create user.');
}