Skip to content

different login approach #45987

Discussion options

You must be logged in to vote

No one answered so here's what i did, i am not sure if this is the standard way to do it but here you go:

User model:

public function getAuthIdentifierName()
{
    return "account_id";
}

Login controller:

$user = User::where('userid', $credentials['userid'])
        ->where('user_pass', md5($credentials['user_pass']))
        ->first();

if (!$user) {
    throw ValidationException::withMessages([
        'userid' => 'The provided credentials do not match our records.'
    ]);
}

Auth::login($user);

$request->session()->regenerate();

return redirect('/')->with('message', 'Welcome, ' . Auth::user()->userid . '!');

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by simplyniceweb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant