Last active
December 15, 2015 02:59
-
-
Save philsturgeon/5190808 to your computer and use it in GitHub Desktop.
Sentry if v exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
$this->sentry->authenticate(array( | |
'email' => $email, | |
'password' => $password, | |
), (bool) $this->input->post('remember')); | |
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { | |
// Could not log in with password. Maybe its an old style pass? | |
try { | |
// Try logging in with this double-hashed password | |
$this->sentry->authenticate(array( | |
'email' => $email, | |
'password' => whacky_old_password_hasher($email, $password), | |
), (bool) $this->input->post('remember')); | |
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { | |
$this->form_validation->set_message('_check_login', 'Incorrect login.'); | |
return false; | |
} | |
} catch (Exception $e) { | |
$this->form_validation->set_message('_check_login', $e->getMessage()); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$result = $this->sentry->authenticate(array( | |
'email' => $email, | |
'password' => $password, | |
), (bool) $this->input->post('remember')); | |
if ($result->getErrorCode() === MyAuth::INCORRECT_CREDENTIALS) { | |
// Try logging in with this double-hashed password | |
$result = $this->sentry->authenticate(array( | |
'email' => $email, | |
'password' => whacky_old_password_hasher($email, $password), | |
), (bool) $this->input->post('remember')); | |
} | |
if ($result->getErrorCode()) { | |
$this->form_validation->set_message('_check_login', $e->getMessage()); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment