initial commit
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
@extends('layouts.loginTemplate')
|
||||
|
||||
@section('content')
|
||||
|
||||
<form class="form w-100" novalidate="novalidate" id="frm-forgot-password" method="post"
|
||||
action="{{ url('post-forgot-password') }}">
|
||||
|
||||
<input type="hidden" name="_method" value="POST">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
|
||||
<!--begin::Heading-->
|
||||
<div class="text-center mb-11">
|
||||
<!--begin::Title-->
|
||||
<h1 class="text-dark fw-bolder mb-3">Forgot Password</h1>
|
||||
<!--end::Title-->
|
||||
</div>
|
||||
<!--begin::Heading-->
|
||||
|
||||
|
||||
<!--begin::Input group=-->
|
||||
<div class="fv-row mb-8">
|
||||
<!--begin::Email-->
|
||||
<input type="email" placeholder="Email" name="email" autocomplete="off"
|
||||
class="form-control bg-transparent" />
|
||||
<!--end::Email-->
|
||||
</div>
|
||||
|
||||
<!--end::Input group=-->
|
||||
<!--begin::Wrapper-->
|
||||
<div class="d-flex flex-stack flex-wrap gap-3 fs-base fw-semibold mb-8">
|
||||
<div></div>
|
||||
<!--begin::Link-->
|
||||
<a href="{{ url('login') }}" class="link-primary">Login ?</a>
|
||||
<!--end::Link-->
|
||||
</div>
|
||||
<!--end::Wrapper-->
|
||||
|
||||
<!--begin::Submit button-->
|
||||
<div class="d-grid mb-10">
|
||||
<button type="button" id="btn-submit" class="btn btn-primary">
|
||||
<!--begin::Indicator label-->
|
||||
<span class="indicator-label">Submit</span>
|
||||
<!--end::Indicator label-->
|
||||
<!--begin::Indicator progress-->
|
||||
<span class="indicator-progress">Please wait...
|
||||
<span class="spinner-border spinner-border-sm align-middle ms-2"></span></span>
|
||||
<!--end::Indicator progress-->
|
||||
</button>
|
||||
</div>
|
||||
<!--end::Submit button-->
|
||||
|
||||
</form>
|
||||
|
||||
@stop
|
||||
|
||||
@section('script')
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$(document).on("click", "#btn-submit", function(e) {
|
||||
|
||||
// handle bomb click
|
||||
e.preventDefault();
|
||||
|
||||
alertLoading("Loading")
|
||||
|
||||
formSubmit()
|
||||
})
|
||||
|
||||
var inputPassword = document.getElementById("input-password");
|
||||
|
||||
// Execute a function when the user presses a key on the keyboard
|
||||
inputPassword.addEventListener("keypress", function(event) {
|
||||
// If the user presses the "Enter" key on the keyboard
|
||||
if (event.key === "Enter") {
|
||||
// Cancel the default action, if needed
|
||||
event.preventDefault();
|
||||
alertLoading("Loading")
|
||||
// Trigger the button element with a click
|
||||
document.getElementById("btn-submit").click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function formSubmit() {
|
||||
// form data
|
||||
const form = $('#frm-forgot-password')[0];
|
||||
const formData = new FormData(form);
|
||||
|
||||
// set up ajax
|
||||
initAjaxSetupToken();
|
||||
|
||||
const ajaxProp = {
|
||||
url: "{{ url('post-forgot-password') }}",
|
||||
dataType: 'json',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
};
|
||||
|
||||
$.ajax(ajaxProp).done(function(res) {
|
||||
if (isAjaxStatusSuccess(res.status)) {
|
||||
alertSuccess('Notice', 'Please check your email address')
|
||||
window.location.href = '{{ url('') }}';
|
||||
hideLoading();
|
||||
} else {
|
||||
alertFail('Notice', res.message ?? "Forgot password unsuccessfully");
|
||||
}
|
||||
}).fail(function(xhr, status, error) {
|
||||
logAjaxError(xhr, status, error);
|
||||
alertFail('Notice', error.message ?? "Forgot password unsuccessfully");
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
Reference in New Issue
Block a user