6
I’m thinking of a way to authenticate users using the email and the CPF of the same, so far not found a way to do, someone has a suggestion?
public function auth(Request $request) {
$credenciais = $request->only('cli_email', 'cli_cpf');
}
6
I’m thinking of a way to authenticate users using the email and the CPF of the same, so far not found a way to do, someone has a suggestion?
public function auth(Request $request) {
$credenciais = $request->only('cli_email', 'cli_cpf');
}
5
The Laravel Framework, has a form of authentication with the instance of class User
, it is then possible to check other relevant data for access to the system, following example:
$user = User::where('cpf', $cpf)->where('email', $email)->first();
if ($user) // se verdade existe um usuário com essas informações
{
Auth::login($user); //efetuando a operação de autenticação
}
but, would not be a security breach?, because, it is easy to discover the CPF and the E-mail of some user, the password should also be informed by being a data of each user.
Browser other questions tagged laravel laravel-5
You are not signed in. Login or sign up in order to post.
I agree with you when you say that it is a security breach, but unfortunately the client needs this type of login, I left the same well informed about the situation, thank you very much for the reply, had already finished the job, but even so I still consider as a response.
– geekcom
No problem @geekcom, it was a warning, and client is client does not always understand our work ... !!!
– novic
And if I have to
email
orcpf
along with the password?– Erlon Charles
@Erloncharles is the same logic only to group the
where
and pass the two parameters, because it only needs the instance to log in. That is to say https://laravel.com/docs/5.6/queries#Parameter-grouping– novic