spoon

User activation

Posted 3 years ago by spoon

Hello.

I have a strange problem that I can't solve.

When a user is registered, I redirect them to a feed url, open a modal and tell my user to activate his account by clicking the email link that I sent them. But after I click the link, I keep being redirected to the exact same page (feed) and my account isn't being activated. What could be the problem here?

routes.php

Route::group(['namespace' => 'Auth'], function ()
{
    Route::group(['middleware' => 'auth'], function ()
    {
        Route::get('activate/{token}', '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();
    $activation->confirmed = 1;
    $activation->save();
}

RedirectIfAuthenticated.php If I remove feed url, it works. But I don't want to do that.

public function handle($request, Closure $next)
{
    if ($this->auth->check()) {

        return redirect('/feed');
    }

    return $next($request);
}

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.