vendredi 2 octobre 2015

Laravel remembering users

I didn't touch anything in the Laravel's registration, I just implemented basic login/register functionality and I created a route to activate users by email, like so. But I couldn't find how to login a user with remember me functionality after activated his account.

My route

Route::get('auth/activate/{token}', 'Auth\PasswordController@activate');

PasswordController

public function activate($token) {
    //get token value.
    // find the user that belongs to that token.
    $activation = User::where("confirmation_code", $token)->get()->first();
    // activate user account
    $activation->confirmed = 1;
    $activation->save();
    Auth::loginUsingId($activation->id); // User is logged in now.
    return view("frontend.feed.index");
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire