M
M
MiJunior2019-05-21 20:13:44
Laravel
MiJunior, 2019-05-21 20:13:44

How to login a user if the password field has a custom name and custom encryption?

The `name` and `passwd` fields are used for registration.
passwd is generated like this: How do I login a user? Changed in user model
md5($request['name'] . $request['passwd], true);

public function getAuthPassword()
{
    return $this->passwd;
}

and in LoginController.php:
public function username()
{
    return 'name';
}

Please do not write "do not use md5", "change field names", etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JhaoDa, 2019-05-21
@JhaoDa

Read the documentation .

N
NubasLol, 2019-05-21
@NubasLol

Well, use manual authentication. Example from the docs. In your case, not email, but name will be
Well, then you yourself from the request, throw the data here ...

public function authenticate()
    {
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            // Аутентификация успешна...
            return redirect()->intended('dashboard');
        }
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question