Created
January 19, 2015 12:21
-
-
Save anonymous/a3f98e442a4ca507e34b to your computer and use it in GitHub Desktop.
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->user->validarDadosLogin(); | |
//Autenticaçõa na base de dados | |
$auth = new Auth($this->user, $this->session, DB::getCon()); | |
$userId = $auth->login(); | |
} | |
catch (InvalidDataException $e) { | |
//Dados inválidos | |
$erro = $e->getMessage(); | |
} | |
catch (DatabaseException $e) { | |
//Erro no bdd | |
$erro = $e->getMessage(); | |
} | |
catch (AuthException $e) { | |
//Usuário inválido | |
$erro = $e->getMessage(); | |
} | |
catch (Exception $e) { | |
$erro = 'Erro inesperrado'; | |
} | |
// OU | |
if ( $this->user->validarDadosLogin() ) { | |
//Autenticaçõa na base de dados | |
$auth = new Auth($this->user, $this->session, DB::getCon()); | |
$userId = $auth->login(); | |
if (!$userId) { | |
$erro = 'Usuário inválido'; | |
} | |
} | |
else { | |
$erro = $this->user->getErro(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment