udemy-go-web-2/cmd/web/templates/forgot-password.page.gohtml

49 lines
1.5 KiB
Plaintext

{{template "base" .}}
{{define "title"}}
Forgot Password
{{end}}
{{define "content"}}
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="alert alert-danger text-center d-none" id="forgot-messages"></div>
<form action=""
method="post"
name="forgot-form"
id="forgot-form"
class="d-blick needs-validation"
autocomplete="off"
novalidate="">
<h2 class="mt-2 mb-3 text-center">Forgot Password</h2>
<hr>
<div class="mb-3">
<label for="-email" class="form-label">Email</label>
<input type="text"
id="email"
name="email"
autocomplete="email-new"
required=""
class="form-control">
</div>
<hr>
<a href="javascript:void(0)" id="reset-btn" class="btn btn-primary">Reset Password</a>
</form>
</div>
</div>
{{end}}
{{define "js"}}
<script type="module">
import {forgot} from "/static/js/login.js"
document.getElementById("reset-btn").addEventListener("click", (event) => {
event.preventDefault();
forgot({{.API}});
})
document.getElementById("email").addEventListener("keypress", (event) => {
if (event.key === "Enter") {
event.preventDefault();
forgot({{.API}});
}
})
</script>
{{end}}