Compare commits

...

1 Commits

Author SHA1 Message Date
7f3b813936
replace hardcoded links to generated ones
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
2023-04-16 14:25:06 +02:00
8 changed files with 25 additions and 19 deletions

View File

@ -3,7 +3,7 @@ var Account = {
countdown: null, countdown: null,
openGoogleAuthenticate: function () { openGoogleAuthenticate: function () {
window.open('/account/googleAuthenticate', 'googleAuthenticate', 'height=600,width=600') window.open(googleAuthenticateUrl, 'googleAuthenticate', 'height=600,width=600')
}, },
authenticatedWithGoogleCallback: function (authenticatedWithGoogleUntil) { authenticatedWithGoogleCallback: function (authenticatedWithGoogleUntil) {

View File

@ -37,7 +37,7 @@ class LoginController
$this->userPasswordResetterRepository = new UserPasswordResetterRepository(); $this->userPasswordResetterRepository = new UserPasswordResetterRepository();
$this->redirectUrl = $this->request->session()->has('redirect_after_login') ? $this->redirectUrl = $this->request->session()->has('redirect_after_login') ?
$this->request->session()->get('redirect_after_login') : $this->request->session()->get('redirect_after_login') :
\Container::$routeCollection->getRoute('index')->generateLink(); \Container::$routeCollection->getRoute('home')->generateLink();
} }
public function getLoginForm() public function getLoginForm()
@ -113,8 +113,8 @@ class LoginController
if ($user === null || !$user->checkPassword($this->request->post('password'))) { if ($user === null || !$user->checkPassword($this->request->post('password'))) {
return new JsonContent([ return new JsonContent([
'error' => [ 'error' => [
'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="/password/requestReset?email=' . 'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="' .
urlencode($this->request->post('email')) . '" title="Request password reset">request password reset</a>!' \Container::$routeCollection->getRoute('password-requestReset')->generateLink(['email' => urlencode($this->request->post('email'))]) . '" title="Request password reset">request password reset</a>!'
] ]
]); ]);
} }
@ -127,7 +127,7 @@ class LoginController
public function loginWithGoogle() public function loginWithGoogle()
{ {
$defaultError = 'Authentication with Google failed. Please <a href="/login/google" title="Login with Google">try again</a>!'; $defaultError = 'Authentication with Google failed. Please <a href="' . \Container::$routeCollection->getRoute('login-google')->generateLink() . '" title="Login with Google">try again</a>!';
if ($this->request->user() !== null) { if ($this->request->user() !== null) {
$this->deleteRedirectUrl(); $this->deleteRedirectUrl();
@ -174,7 +174,7 @@ class LoginController
{ {
$this->request->setUser(null); $this->request->setUser(null);
return new Redirect(\Container::$routeCollection->getRoute('index')->generateLink(), IRedirect::TEMPORARY); return new Redirect(\Container::$routeCollection->getRoute('home')->generateLink(), IRedirect::TEMPORARY);
} }
public function requestPasswordReset(): IContent public function requestPasswordReset(): IContent

View File

@ -110,10 +110,10 @@ class OAuthController
{ {
return new JsonContent([ return new JsonContent([
'issuer' => $_ENV['APP_URL'], 'issuer' => $_ENV['APP_URL'],
'authorization_endpoint' => $this->request->getBase() . '/oauth/auth', 'authorization_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-auth')->generateLink(),
'token_endpoint' => $this->request->getBase() . '/oauth/token', 'token_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-token')->generateLink(),
'userinfo_endpoint' => $this->request->getBase() . '/oauth/userinfo', 'userinfo_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-userinfo')->generateLink(),
'jwks_uri' => $this->request->getBase() . '/oauth/certs', 'jwks_uri' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-certs')->generateLink(),
'response_types_supported' => 'response_types_supported' =>
[ [
'code', 'code',

View File

@ -5,7 +5,7 @@
@section(main) @section(main)
<h2>Account</h2> <h2>Account</h2>
<div class="box"> <div class="box">
<form id="accountForm" action="/account" method="post" data-reload-on-success="true" data-observe-inputs="email,username,password_new,password_new_confirm,nickname,phone,id_number"> <form id="accountForm" action="/<?= Container::$routeCollection->getRoute('account-action')->generateLink() ?>" method="post" data-reload-on-success="true" data-observe-inputs="email,username,password_new,password_new_confirm,nickname,phone,id_number">
<?php if ($user['password'] !== null && $user['google_sub'] !== null): ?> <?php if ($user['password'] !== null && $user['google_sub'] !== null): ?>
<p class="justify small">Please confirm your identity with your password or with Google to modify your account.</p> <p class="justify small">Please confirm your identity with your password or with Google to modify your account.</p>
<div class="inputWithButton"> <div class="inputWithButton">
@ -39,3 +39,9 @@
</form> </form>
</div> </div>
@endsection @endsection
@section(pageScript)
<script>
var googleAuthenticateUrl = '/<?= Container::$routeCollection->getRoute('account.googleAuthenticate')->generateLink() ?>';
</script>
@endsection

View File

@ -3,17 +3,17 @@
@section(main) @section(main)
<h2>Login</h2> <h2>Login</h2>
<div class="box"> <div class="box">
<form id="loginForm" action="/login" method="post" data-redirect-on-success="<?= $redirectUrl ?>"> <form id="loginForm" action="/<?= Container::$routeCollection->getRoute('login-action')->generateLink() ?>" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / Username" required autofocus> <input type="text" class="text big fullWidth" name="email" placeholder="Email address / Username" required autofocus>
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6"> <input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6">
<p id="loginFormError" class="formError justify marginTop"></p> <p id="loginFormError" class="formError justify marginTop"></p>
<div class="right marginTop"> <div class="right marginTop">
<button type="submit">Login</button> <button type="submit">Login</button>
</div> </div>
<p class="center marginTop"><a href="/password/requestReset" title="Request password reset">Forgot your password?</a></p> <p class="center marginTop"><a href="/<?= Container::$routeCollection->getRoute('password-requestReset')->generateLink() ?>" title="Request password reset">Forgot your password?</a></p>
<hr> <hr>
<div class="center"> <div class="center">
<a class="button yellow" href="/login/google" title="Login with Google">Login with Google</a> <a class="button yellow" href="/<?= Container::$routeCollection->getRoute('login-google')->generateLink() ?>" title="Login with Google">Login with Google</a>
</div> </div>
</form> </form>
</div> </div>

View File

@ -5,7 +5,7 @@
@section(main) @section(main)
<h2>Request password reset</h2> <h2>Request password reset</h2>
<div class="box"> <div class="box">
<form id="passwordResetForm" action="/password/requestReset" method="post" data-redirect-on-success="/password/requestReset/success"> <form id="passwordResetForm" action="/<?= Container::$routeCollection->getRoute('password-requestReset-action')->generateLink() ?>" method="post" data-redirect-on-success="/<?= Container::$routeCollection->getRoute('password-requestReset.success')->generateLink() ?>">
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= isset($email) ? $email : '' ?>" required autofocus> <input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= isset($email) ? $email : '' ?>" required autofocus>
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?> <?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
<div class="marginTop"> <div class="marginTop">

View File

@ -4,7 +4,7 @@
<h2>Reset password</h2> <h2>Reset password</h2>
<div class="box"> <div class="box">
<?php if ($success) : ?> <?php if ($success) : ?>
<form id="resetPasswordForm" action="/password/reset/<?= $token ?>" method="post" data-redirect-on-success="<?= $redirectUrl ?>"> <form id="resetPasswordForm" action="/<?= Container::$routeCollection->getRoute('password-reset.action')->generateLink(['token' => $token]) ?>"" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= $email ?>" disabled> <input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= $email ?>" disabled>
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6" autofocus> <input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6" autofocus>
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" required minlength="6"> <input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" required minlength="6">
@ -14,7 +14,7 @@
</div> </div>
</form> </form>
<?php else: ?> <?php else: ?>
<p class="error justify">Confirming your identity failed. Please check the link you entered, or retry <a href="/password/requestReset" title="Request password reset">requesting password reset</a>!</p> <p class="error justify">Confirming your identity failed. Please check the link you entered, or retry <a href="/<?= Container::$routeCollection->getRoute('password-requestReset')->generateLink() ?>" title="Request password reset">requesting password reset</a>!</p>
<?php endif; ?> <?php endif; ?>
</div> </div>
@endsection @endsection

View File

@ -10,14 +10,14 @@
</h1> </h1>
<p> <p>
<?php if (Container::$request->user()) : ?> <?php if (Container::$request->user()) : ?>
<span><a href="/account" title="Account"> <span><a href="/<?= Container::$routeCollection->getRoute('account')->generateLink() ?>" title="Account">
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?> <?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> <svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/> <path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
</svg><!-- </svg><!--
--><?= Container::$request->user()->getDisplayName() ?><!-- --><?= Container::$request->user()->getDisplayName() ?><!--
--></a></span><!-- --></a></span><!--
--><span><a href="/logout" title="Logout">Logout</a></span> --><span><a href="/<?= Container::$routeCollection->getRoute('logout')->generateLink() ?>" title="Logout">Logout</a></span>
<?php endif; ?> <?php endif; ?>
</p> </p>
</header> </header>