Use translated Hint instead of english error on password policy

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-06-14 12:17:16 +02:00
parent 0f8c1b13a3
commit e62e7a201d
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 4 additions and 0 deletions

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;
@ -406,6 +407,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.');
}