diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-03-13 19:29:52 +0300 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-03-13 21:06:41 +0300 |
commit | 4b8558522b354e4f0f08c62b0ec78cef9d2985ef (patch) | |
tree | b4a262c096cf8fbdf849b96ca61a1ebc19a9ea0d /lib | |
parent | 32f9a87ba3fe2c96c86bf7962551f8b2c0f4d9f0 (diff) |
detect disabled user and show a appropriated error message
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/SAMLController.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index 1958abc4..b3e53d4d 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -27,6 +27,7 @@ use OCA\User_SAML\UserBackend; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\IConfig; +use OCP\IL10N; use OCP\ILogger; use OCP\IRequest; use OCP\ISession; @@ -52,6 +53,8 @@ class SAMLController extends Controller { private $userManager; /** @var ILogger */ private $logger; + /** @var IL10N */ + private $l; /** * @param string $appName @@ -64,6 +67,7 @@ class SAMLController extends Controller { * @param IURLGenerator $urlGenerator * @param IUserManager $userManager * @param ILogger $logger + * @param IL10N $l */ public function __construct($appName, IRequest $request, @@ -74,7 +78,8 @@ class SAMLController extends Controller { IConfig $config, IURLGenerator $urlGenerator, IUserManager $userManager, - ILogger $logger) { + ILogger $logger, + IL10N $l) { parent::__construct($appName, $request); $this->session = $session; $this->userSession = $userSession; @@ -84,6 +89,7 @@ class SAMLController extends Controller { $this->urlGenerator = $urlGenerator; $this->userManager = $userManager; $this->logger = $logger; + $this->l = $l; } /** @@ -288,4 +294,19 @@ class SAMLController extends Controller { public function notProvisioned() { return new Http\TemplateResponse($this->appName, 'notProvisioned', [], 'guest'); } + + + /** + * @PublicPage + * @NoCSRFRequired + * @OnlyUnauthenticatedUsers + * @param string $message + * @return Http\TemplateResponse + */ + public function genericError($message) { + if (empty($message)) { + $message = $this->l->t('Unknown error, please check the log file for more details.'); + } + return new Http\TemplateResponse($this->appName, 'error', ['message' => $message], 'guest'); + } } |