Skip to content

Commit

Permalink
Merge pull request #18 from thedevdojo/updateUerModel
Browse files Browse the repository at this point in the history
adding updates to the verify and register functionality
  • Loading branch information
tnylea authored May 22, 2024
2 parents e50eb7d + adaafc0 commit 14d884d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion resources/views/pages/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ public function register()
Auth::login($user, true);
return redirect()->intended('/');
if(config('devdojo.auth.settings.registration_require_email_verification')){
return redirect()->route('verification.notice');
}
return redirect()->intended(config('devdojo.auth.settings.redirect_after_auth'));
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/VerifyEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class VerifyEmailController
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
return redirect()->intended(config('devdojo.auth.settings.redirect_after_auth').'?verified=1');
}

if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}

return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
return redirect()->intended(config('devdojo.auth.settings.redirect_after_auth').'?verified=1');
}
}
2 changes: 1 addition & 1 deletion tests/Feature/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
->set('name', 'John Doe')
->call('register')
->assertHasNoErrors()
->assertRedirect('/');
->assertRedirect('/dashboard');

$this->assertTrue(Auth::check());
$this->assertEquals('user@example.com', Auth::user()->email);
Expand Down

0 comments on commit 14d884d

Please sign in to comment.