Support the ongoing development of Laravel.io →
Authentication Mail
Last updated 10 months ago.
0
public function postLogin() {
	try {
		if ( ! Auth::attempt( Input::only('email', 'password') ) ) {
			throw new UserNotFoundException();
		}

		if ( Auth::once( Input::only('email', 'password') ) ) {
			if ( ! Auth::user()->active ) {
				Auth::logout();
				throw new UserNotActivatedException();
			}
		}

		// return 
	}

	catch (UserNotFoundException $e) {
		Session::flash('error', 'Invalid email or password.');
		// return
	}

	catch (UserNotActivatedException $e) {
		Session::flash('error', 'Account not activated.');
		// return
	}
}
Last updated 10 months ago.
0

do you mind explaining a bit how this works and to what function do I add the the boolean for the remember token !!

Last updated 10 months ago.
0

The first bit checks if the user used the right credentials. If the user did not give the right credentials it throws an error.

The second part checks if the user is activated.

Last updated 10 months ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

minedun6 minedun6 Joined 30 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.