rvr-nextgen/views/account/account.php

68 lines
4.6 KiB
PHP
Raw Permalink Normal View History

2023-04-08 00:42:55 +02:00
@js(js/account/account.js)
@extends(templates/layout_normal)
@section(main)
<h2>Account</h2>
2023-05-01 19:18:48 +02:00
<div class="box compactBox">
2023-04-16 20:54:29 +02:00
<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">
2023-04-08 00:42:55 +02:00
<?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" autocomplete="current-password" required minlength="6" autofocus><!--
2023-05-06 21:42:43 +02:00
--><button id="authenticateWithGoogleButton" class="yellow" type="button"><i class="fa-brands fa-google"></i></button>
2023-04-08 00:42:55 +02:00
</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" autocomplete="current-password" required minlength="6" autofocus>
2023-04-08 00:42:55 +02:00
<?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><!--
2023-05-06 21:42:43 +02:00
--><button id="authenticateWithGoogleButton" class="yellow" type="button"><i class="fa-brands fa-google"></i></button>
2023-04-08 00:42:55 +02:00
</div>
<?php endif; ?>
<hr>
<p class="formLabel">Email address</p>
<input type="email" class="text big fullWidth" name="email" autocomplete="username" value="<?= $user['email'] ?>">
<p class="formLabel marginTop">Username</p>
<input type="text" class="text big fullWidth" name="username" value="<?= $user['username'] ?>">
<p class="formLabel marginTop">New password</p>
<input type="password" class="text big fullWidth" name="password_new" autocomplete="new-password" minlength="6">
<p class="formLabel marginTop">New password confirmation</p>
<input type="password" class="text big fullWidth" name="password_new_confirm" autocomplete="new-password" minlength="6">
<hr>
<p class="formLabel marginTop">Full name</p>
<input type="text" class="text big fullWidth" name="full_name" value="<?= $user['full_name'] ?>" disabled>
<p class="formLabel marginTop marginTop">Nickname</p>
<input type="text" class="text big fullWidth" name="nickname" value="<?= $user['nickname'] ?>">
<p class="formLabel marginTop marginTop">Phone</p>
<input type="text" class="text big fullWidth" name="phone" value="<?= $user['phone'] ?>">
<p class="formLabel marginTop marginTop">ID number</p>
<input type="text" class="text big fullWidth" name="id_number" value="<?= $user['id_number'] ?>">
2023-04-08 00:42:55 +02:00
<p id="accountFormError" class="formError justify marginTop"></p>
<div class="right marginTop">
2023-05-06 21:42:43 +02:00
<button type="submit" name="submit_button" disabled><i class="fa-regular fa-floppy-disk"></i> Save</button>
2023-04-08 00:42:55 +02:00
</div>
<hr>
<div class="center">
<?php if ($user['google_sub'] === null): ?>
2023-05-06 21:42:43 +02:00
<a class="button yellow" href="<?= Container::$routeCollection->getRoute('account.googleConnect')->generateLink() ?>" title="Connect with Google"><i class="fa-solid fa-link"></i> Connect with Google</a>
<?php else: ?>
<?php if ($user['password'] !== null): ?>
2023-05-06 21:42:43 +02:00
<a class="button yellow" href="<?= Container::$routeCollection->getRoute('account.googleDisconnect')->generateLink() ?>" title="Disconnect from Google"><i class="fa-solid fa-link-slash"></i> Disconnect from Google</a>
<?php else: ?>
<p class="bold small">Your account does not have a password. Please set a password if you want to disconnect your account from Google.</p>
<?php endif; ?>
<?php endif; ?>
</div>
2023-04-08 00:42:55 +02:00
</form>
</div>
@endsection
@section(pageScript)
<script>
2023-04-16 20:54:29 +02:00
var googleAuthenticateUrl = '<?= Container::$routeCollection->getRoute('account.googleAuthenticate')->generateLink() ?>';
</script>
@endsection