Quellcode durchsuchen

show login error

tags/v9.1.0beta1
Christoph Wurst vor 8 Jahren
Ursprung
Commit
3ffa7d986a
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 12 neuen und 5 gelöschten Zeilen
  1. 12
    5
      core/Controller/LoginController.php

+ 12
- 5
core/Controller/LoginController.php Datei anzeigen

} }


$parameters = array(); $parameters = array();
$id = $this->session->getId();
$loginMessages = $this->session->get('loginMessages'); $loginMessages = $this->session->get('loginMessages');
$errors = []; $errors = [];
$messages = []; $messages = [];
*/ */
public function tryLogin($user, $password, $redirect_url) { public function tryLogin($user, $password, $redirect_url) {
// TODO: Add all the insane error handling // TODO: Add all the insane error handling
$loginResult = $this->userManager->checkPassword($user, $password) === false;
if ($loginResult) {
$loginResult = $this->userManager->checkPassword($user, $password) !== false;
if (!$loginResult) {
$users = $this->userManager->getByEmail($user); $users = $this->userManager->getByEmail($user);
// we only allow login by email if unique // we only allow login by email if unique
if (count($users) === 1) { if (count($users) === 1) {
$loginResult = $this->userManager->checkPassword($users[0]->getUID(), $password); $loginResult = $this->userManager->checkPassword($users[0]->getUID(), $password);
} }
} }
if ($loginResult) {
return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm'));
if (!$loginResult) {
$id = $this->session->getId();
$this->session->set('loginMessages', [
[],
['invalidpassword']
]);
// Read current user and append if possible
$args = !is_null($user) ? ['user' => $user] : [];
return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
} }
$this->userSession->createSessionToken($this->request, $user, $password); $this->userSession->createSessionToken($this->request, $user, $password);
if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) { if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) {
return new RedirectResponse($location); return new RedirectResponse($location);
} }
} }
// TODO: Show invalid login warning
return new RedirectResponse($this->urlGenerator->linkTo('files', 'index')); return new RedirectResponse($this->urlGenerator->linkTo('files', 'index'));
} }



Laden…
Abbrechen
Speichern