Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Last active December 15, 2015 02:59
Show Gist options
  • Save philsturgeon/5190808 to your computer and use it in GitHub Desktop.
Save philsturgeon/5190808 to your computer and use it in GitHub Desktop.
Sentry if v exception
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;
}
$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