Добавил повторение пароля
This commit is contained in:
parent
5c72b569da
commit
c64d3bf2d9
1 changed files with 8 additions and 0 deletions
|
|
@ -32,6 +32,10 @@ if (Astro.cookies.has("session")) {
|
||||||
<label for="password" class="form-label">Пароль</label>
|
<label for="password" class="form-label">Пароль</label>
|
||||||
<input type="password" class="form-control" id="password" id="login" name="password" required />
|
<input type="password" class="form-control" id="password" id="login" name="password" required />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="passwordConfirm" class="form-label">Повтор пароля</label>
|
||||||
|
<input type="password" class="form-control" id="passwordConfirm" id="login" name="passwordConfirm" required />
|
||||||
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary">Зарегистрироваться</button>
|
<button type="submit" class="btn btn-primary">Зарегистрироваться</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -49,6 +53,10 @@ if (Astro.cookies.has("session")) {
|
||||||
async function doRegistration(form) {
|
async function doRegistration(form) {
|
||||||
try {
|
try {
|
||||||
const fd = new FormData(form);
|
const fd = new FormData(form);
|
||||||
|
if (fd.get("password") && fd.get("password") !== fd.get("passwordConfirm")) {
|
||||||
|
alert("Пароли не совпадают");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const resp = await fetch("/gate/register", {
|
const resp = await fetch("/gate/register", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: fd,
|
body: fd,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue