Redirect to sign-up if already logged in
This commit is contained in:
parent
a2a57ec852
commit
4267a76adb
|
@ -61,6 +61,11 @@ class SignUpController extends BaseController
|
||||||
return $this->redirect->to('/oauth/' . $provider->provider);
|
return $this->redirect->to('/oauth/' . $provider->provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->auth->user()) {
|
||||||
|
// User is already logged in - that means a supporter has registered an angel. Return to register page.
|
||||||
|
return $this->redirect->to('/sign-up');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirect->to('/');
|
return $this->redirect->to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,26 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
$this->assertFalse($this->session->has('show_welcome'));
|
$this->assertFalse($this->session->has('show_welcome'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Controllers\SignUpController
|
||||||
|
*/
|
||||||
|
public function testSaveAlreadyLoggedIn(): void
|
||||||
|
{
|
||||||
|
$this->setPasswordRegistrationEnabledConfig();
|
||||||
|
$request = $this->request->withParsedBody(['user' => 'data']);
|
||||||
|
|
||||||
|
// Fake logged in user
|
||||||
|
$this->authenticator->method('user')->willReturn(new EngelsystemUser());
|
||||||
|
|
||||||
|
// Assert that the user is redirected to /sign-up again
|
||||||
|
$this->response
|
||||||
|
->expects(self::once())
|
||||||
|
->method('redirectTo')
|
||||||
|
->with('http://localhost/sign-up', 302);
|
||||||
|
|
||||||
|
$this->subject->save($request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\SignUpController
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue