Bubble up db error for login
This commit is contained in:
parent
ba7ec636f4
commit
d027fa27b6
|
|
@ -39,12 +39,18 @@ class LoginController extends Controller
|
|||
$errors['password'] = "Please enter a Password.";
|
||||
}
|
||||
if(!empty($username) && !empty($password)) {
|
||||
if($login->login($username, $password)) {
|
||||
$this->container->setNotice("<strong>Success!</strong> You have been successfully logged in.");
|
||||
$this->doRedirect();
|
||||
} else {
|
||||
$errors['login'] = "Invalid credentials. Please check your username and password, and try again.";
|
||||
try {
|
||||
if($login->login($username, $password)) {
|
||||
$this->container->setNotice("<strong>Success!</strong> You have been successfully logged in.");
|
||||
$this->doRedirect();
|
||||
} else {
|
||||
$errors['login'] = "Invalid credentials. Please check your username and password, and try again.";
|
||||
}
|
||||
} catch (StorageException $e) {
|
||||
$errors['login'] = "Error: Database is not available.";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,11 @@ class Login
|
|||
$usernameCanonical = $this->ircToLower($username);
|
||||
|
||||
// Storage get salt, hashedPassword, capabilities for user
|
||||
$results = $this->storage->getLoginByUsernameCanonical($usernameCanonical);
|
||||
|
||||
try {
|
||||
$results = $this->storage->getLoginByUsernameCanonical($usernameCanonical);
|
||||
} catch(StorageException $e) {
|
||||
throw $e;
|
||||
}
|
||||
if(count($results) < 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue