108 lines
4.5 KiB
PHP
108 lines
4.5 KiB
PHP
<?php $currentPage = "security" ?>
|
|
@extends('Frontend.layouts.master')
|
|
@section('content')
|
|
<div class="security-pages">
|
|
<div class="container" style="display: flex;justify-content: center">
|
|
<div class="security-form" data-aos="fade-right">
|
|
<h2>Security</h2>
|
|
<div class="security-text">
|
|
<h4>Update Password</h4>
|
|
<p>Update your password and secure your account</p>
|
|
</div>
|
|
<form id="changePasswordForm">
|
|
@csrf
|
|
@method('PATCH')
|
|
<div >
|
|
<label for="password">Current Password <span class="start">*</span></label><br>
|
|
<input style=" margin-bottom: 2px;" type="password" id="password" name="password" class="pwd-input" placeholder="Enter password">
|
|
</div>
|
|
<!-- <i class="far fa-eye-slash" id="togglePassword" style="margin-left: -30px; cursor: pointer;"></i> -->
|
|
|
|
<div style=" margin-top: 10px;">
|
|
<label for="newPassword">New Password <span class="start">*</span></label><br>
|
|
<input style=" margin-bottom: 2px;" type="password" id="newPassword" name="newPassword" class="pwd-input" placeholder="Enter New password">
|
|
</div>
|
|
<!-- <i class="far fa-eye-slash" id="togglePassword" style="margin-left: -30px; cursor: pointer;"></i> -->
|
|
|
|
<div style=" margin-top: 10px;">
|
|
<label for="newPassword_confirmation">Confirm Password <span class="start">*</span></label><br>
|
|
<input style=" margin-bottom: 2px;" type="password" id="newPassword_confirmation" name="newPassword_confirmation" class="pwd-input" placeholder="Enter Confirm password">
|
|
</div>
|
|
<!-- <i class="far fa-eye-slash" id="togglePassword" style="margin-left: -30px; cursor: pointer;"></i> -->
|
|
<button style=" margin-top: 20px;" class="u-pwd" type="submit">Update Password</button>
|
|
{{--<div class="authenticate">
|
|
<h4>Security Authentication</h4>
|
|
</div>
|
|
|
|
<label for="auth-q">In what city were you born?</label><br>
|
|
<input type="text" id="auth-q" name="auth-q" class="auth-q" placeholder="Your Answer" required="">--}}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection()
|
|
@section('scripts')
|
|
<script>
|
|
$.validator.addMethod(
|
|
"StrongPassword",
|
|
function(value) {
|
|
return /^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/.test(
|
|
value
|
|
);
|
|
},
|
|
// "Password must contain 8 chars(UpperCase,LowerCase,Number,SpecialChars)"
|
|
"Password Must Contain <br> 8 characters <br> At least 1 uppercase letter and symbol <br> Has a number"
|
|
);
|
|
$("#changePasswordForm").validate({
|
|
rules: {
|
|
password: 'required',
|
|
newPassword: {
|
|
required: true,
|
|
StrongPassword: true
|
|
},
|
|
newPassword_confirmation: {
|
|
required: true,
|
|
equalTo: '#newPassword',
|
|
},
|
|
},
|
|
messages: {
|
|
password: 'Please enter your current password',
|
|
newPassword: {
|
|
required: 'Please enter your new password'
|
|
},
|
|
newPassword_confirmation: {
|
|
required: "Please confirm your password",
|
|
minlength: "Your password must be at least 8 characters long",
|
|
equalTo: "Your password do not match",
|
|
},
|
|
},
|
|
submitHandler: function(form) {
|
|
var formData = new FormData(form);
|
|
$.ajaxSetup({
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr(
|
|
"content"
|
|
),
|
|
},
|
|
});
|
|
$.ajax({
|
|
url: "{{route('change-password')}}",
|
|
type: "POST",
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
dataType : 'json',
|
|
success: function(data) {
|
|
if(data.status == 200){
|
|
toastr.success(data.message);
|
|
window.location.href = '{{route("login")}}';
|
|
}
|
|
if(data.status == 400){
|
|
toastr.warning(data.message)
|
|
}
|
|
}
|
|
});
|
|
},
|
|
});
|
|
</script>
|
|
@endsection
|