replace hardcoded links to generated ones #20
@ -3,7 +3,7 @@ var Account = {
 | 
			
		||||
    countdown: null,
 | 
			
		||||
 | 
			
		||||
    openGoogleAuthenticate: function () {
 | 
			
		||||
        window.open('/account/googleAuthenticate', 'googleAuthenticate', 'height=600,width=600')
 | 
			
		||||
        window.open(googleAuthenticateUrl, 'googleAuthenticate', 'height=600,width=600')
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    authenticatedWithGoogleCallback: function (authenticatedWithGoogleUntil) {
 | 
			
		||||
 | 
			
		||||
@ -113,8 +113,8 @@ class LoginController
 | 
			
		||||
        if ($user === null || !$user->checkPassword($this->request->post('password'))) {
 | 
			
		||||
            return new JsonContent([
 | 
			
		||||
                'error' => [
 | 
			
		||||
                    'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="/password/requestReset?email=' .
 | 
			
		||||
                        urlencode($this->request->post('email')) . '" title="Request password reset">request password reset</a>!'
 | 
			
		||||
                    'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="' .
 | 
			
		||||
                        \Container::$routeCollection->getRoute('password-requestReset')->generateLink(['email' => $this->request->post('email')]) . '" title="Request password reset">request password reset</a>!'
 | 
			
		||||
                ]
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
@ -127,7 +127,7 @@ class LoginController
 | 
			
		||||
 | 
			
		||||
    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) {
 | 
			
		||||
            $this->deleteRedirectUrl();
 | 
			
		||||
 | 
			
		||||
@ -110,10 +110,10 @@ class OAuthController
 | 
			
		||||
    {
 | 
			
		||||
        return new JsonContent([
 | 
			
		||||
            'issuer' => $_ENV['APP_URL'],
 | 
			
		||||
            'authorization_endpoint' => $this->request->getBase() . '/oauth/auth',
 | 
			
		||||
            'token_endpoint' => $this->request->getBase() . '/oauth/token',
 | 
			
		||||
            'userinfo_endpoint' => $this->request->getBase() . '/oauth/userinfo',
 | 
			
		||||
            'jwks_uri' => $this->request->getBase() . '/oauth/certs',
 | 
			
		||||
            'authorization_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-auth')->generateLink(),
 | 
			
		||||
            'token_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-token')->generateLink(),
 | 
			
		||||
            'userinfo_endpoint' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-userinfo')->generateLink(),
 | 
			
		||||
            'jwks_uri' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('oauth-certs')->generateLink(),
 | 
			
		||||
            'response_types_supported' =>
 | 
			
		||||
            [
 | 
			
		||||
                'code',
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>Account</h2>
 | 
			
		||||
    <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): ?>
 | 
			
		||||
                <p class="justify small">Please confirm your identity with your password or with Google to modify your account.</p>
 | 
			
		||||
                <div class="inputWithButton">
 | 
			
		||||
@ -39,3 +39,9 @@
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section(pageScript)
 | 
			
		||||
<script>
 | 
			
		||||
    var googleAuthenticateUrl = '/<?= Container::$routeCollection->getRoute('account.googleAuthenticate')->generateLink() ?>';
 | 
			
		||||
</script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@ -3,17 +3,17 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>Login</h2>
 | 
			
		||||
    <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="password"  class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6">
 | 
			
		||||
            <p id="loginFormError" class="formError justify marginTop"></p>
 | 
			
		||||
            <div class="right marginTop">
 | 
			
		||||
                <button type="submit">Login</button>
 | 
			
		||||
            </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>
 | 
			
		||||
            <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>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>Request password reset</h2>
 | 
			
		||||
    <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>
 | 
			
		||||
            <?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
 | 
			
		||||
                <div class="marginTop">
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
    <h2>Reset password</h2>
 | 
			
		||||
    <div class="box">
 | 
			
		||||
        <?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="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">
 | 
			
		||||
@ -14,7 +14,7 @@
 | 
			
		||||
                </div>
 | 
			
		||||
            </form>
 | 
			
		||||
        <?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; ?>
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@ -10,14 +10,14 @@
 | 
			
		||||
    </h1>
 | 
			
		||||
    <p>
 | 
			
		||||
        <?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'. */ ?>
 | 
			
		||||
                <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"/>
 | 
			
		||||
                </svg><!--
 | 
			
		||||
             --><?= Container::$request->user()->getDisplayName() ?><!--
 | 
			
		||||
            --></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; ?>
 | 
			
		||||
    </p>
 | 
			
		||||
</header>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user