mapguesser/views/account/account.php

48 lines
3.4 KiB
PHP
Raw Normal View History

2020-06-28 19:32:30 +02:00
@js(js/account/account.js)
2020-06-28 19:32:30 +02:00
@extends(templates/layout_normal)
2020-06-28 19:32:30 +02:00
@section(main)
2020-06-25 16:44:34 +02:00
<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">
<?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">
<input type="password" class="text" name="password" placeholder="Current password" autocomplete="current-password" required minlength="6" autofocus><!--
--><button id="authenticateWithGoogleButton" class="yellow" type="button">Google</button>
</div>
<?php elseif ($user['password'] !== null): ?>
<p class="justify small">Please confirm your identity with your password to modify your account.</p>
<input type="password" class="text big fullWidth" name="password" placeholder="Current password" autocomplete="current-password" required minlength="6" autofocus>
<?php elseif ($user['google_sub'] !== null): ?>
<p class="justify small">Please confirm your identity with Google to modify your account.</p>
<div class="inputWithButton">
<input type="text" class="text" name="password" placeholder="Authenticate with Google..." disabled><!--
--><button id="authenticateWithGoogleButton" class="yellow" type="button">Google</button>
</div>
<?php endif; ?>
<hr>
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" autocomplete="username" value="<?= $user['email'] ?>">
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" value="<?= $user['username'] ?>">
<input type="password" class="text big fullWidth marginTop" name="password_new" placeholder="New password" autocomplete="new-password" minlength="6">
<input type="password" class="text big fullWidth marginTop" name="password_new_confirm" placeholder="New password confirmation" autocomplete="new-password" minlength="6">
2020-06-25 16:44:34 +02:00
<p id="accountFormError" class="formError justify marginTop"></p>
<div class="right marginTop">
2023-09-24 00:40:16 +02:00
<button type="submit" name="submit_button" disabled>Save</button>
</div>
2020-06-25 20:26:33 +02:00
<hr>
<div class="center" style="font-size: 0;">
<?php if ($user['google_sub'] === null): ?>
<a class="button yellow marginRight" href="<?= Container::$routeCollection->getRoute('account.googleConnect')->generateLink() ?>" title="Connect with Google">Connect with Google</a>
<?php else: ?>
<?php if ($user['password'] !== null): ?>
<a class="button yellow marginRight" href="<?= Container::$routeCollection->getRoute('account.googleDisconnect')->generateLink() ?>" title="Disconnect from Google">Disconnect from Google</a>
<?php endif; ?>
<?php endif; ?>
2020-06-25 20:26:33 +02:00
<a class="button red" href="/account/delete" title="Delete account">Delete account</a>
</div>
</form>
</div>
@endsection