summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-05-04 09:05:03 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-05-11 13:36:46 +0200
commit3ffa7d986a3bb2a67ae37e017f3e34097774cbf2 (patch)
treebcfca197cc84e13b89fec8f2ae03fbcb68a59a42
parenta9b500c03ba469a557ca235e69b7a72494cf6a9b (diff)
downloadnextcloud-server-3ffa7d986a3bb2a67ae37e017f3e34097774cbf2.tar.gz
nextcloud-server-3ffa7d986a3bb2a67ae37e017f3e34097774cbf2.zip
show login error
-rw-r--r--core/Controller/LoginController.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index e9352b079f7..977f523afda 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -106,6 +106,7 @@ class LoginController extends Controller {
}
$parameters = array();
+ $id = $this->session->getId();
$loginMessages = $this->session->get('loginMessages');
$errors = [];
$messages = [];
@@ -167,16 +168,23 @@ class LoginController extends Controller {
*/
public function tryLogin($user, $password, $redirect_url) {
// 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);
// we only allow login by email if unique
if (count($users) === 1) {
$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);
if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) {
@@ -187,7 +195,6 @@ class LoginController extends Controller {
return new RedirectResponse($location);
}
}
- // TODO: Show invalid login warning
return new RedirectResponse($this->urlGenerator->linkTo('files', 'index'));
}