mardi 15 novembre 2016

Complete account before logging in (Laravel 5.2)

In the site I am developing, some users are able to sign-up for an account, but leave the registration process part-way through.

However, if they have passed a critical stage in registration, they will be allowed to log in if they try. At this point, I want to direct them to a page where they must complete their account details before they are able to access the site.

I am looking to make a sort of impenetrable wall, so they must complete registration before using their account. Currently, I am just redirecting the users once they login, like this:

public function authenticated($request, $user)
{
    if ($user->regComplete == false) {
        auth()->logout();
        flash('you are not verified');
        return redirect('/login');
    }
    return redirect('/');
}

However, I would like to redirect some users to the aforementioned page. I will redirect them like this

if ($user->incomplete) {
    return redirect('/account/complete');
}

However, I am not too sure what the best practice is for a compulsory account completion page is.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire