Logging in to Laravel password without hash

Asked

Viewed 150 times

1

Good people! I took a very old system to make some "improvements", I used Laravel to develop a system that mainly uses the database of this system. The BIG problem is, the passwords saved in the comic are without HASH. I know it’s wrong, I’ve been in trouble with them to change that, but they don’t, so I’ve run out of things to do.

My question is:

How to login to Laravel using passwords without HASH?

Or does anyone have any idea how to circulate this problem?

Grateful!

1 answer

2


If you can use, authentication by the instance of the user you search for email and then compare the password.

Remembering how you yourself reported, the password in this way is very problematic.

public function postLogin(Request $request)
{

    $email = $request->get('email');
    $passwd = $request->get('password');

    $user = User::where('email', $email)->first();

    if ($user && $passwd === $user->passwd)
    {
        Auth::login($user); // logando
        return Redirect::intended('admin');     
    }

    return Redirect::back()->with('error_message', 'Dados Incorrectos')->withInput();
}

Ref.

  • 1

    Thanks! It worked perfect, I just changed the function name to **public Function login() **

Browser other questions tagged

You are not signed in. Login or sign up in order to post.