Files
2025-10-04 21:51:32 +08:00

108 lines
6.2 KiB
PHP

@extends('includes.login.index')
@section('content')
<h6 style="text-align: center; margin-bottom: 10%;">Tetap Semula Kata Laluan</h6>
<form role="form" method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<div class="input-group input-group-outline my-3 bg-light {{ $errors->has('email') ? ' has-danger' : '' }} mb-3">
<input class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" placeholder="{{ __('Email') }}" type="email" name="email" value="{{ $email ?? old('email') }}" required autofocus readonly>
</div>
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
<div class="input-group input-group-outline {{ $errors->has('password') ? ' has-danger' : '' }}" style="position: relative;">
<input id="password" onKeyUp="checkPasswordStrength();" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{ __('Password') }}" type="password" required>
<span
class="input-group-text border-0 position-absolute end-0 top-0 h-100 d-flex align-items-center"
style="cursor:pointer; z-index: 3; border-radius: 0 0.375rem 0.375rem 0; border-left: none; border: 1px solid #ced4da; background: transparent; padding: 0 12px; height: 100%; display: flex; align-items: center; box-shadow: none; top: 0; bottom: 0;"
onclick="togglePasswordVisibility('password', 'eyeIcon-password')"
tabindex="0"
aria-label="Toggle password visibility"
>
<svg id="eyeIcon-password" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
</span>
</div>
@if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
<div class="text-muted font-italic mb-3">
<small>{{ __('password strength') }}: <span class="text-muted font-weight-700" id="password-strength-status">none</span></small>
</div>
<div class="input-group input-group-outline my-3" style="position: relative;">
<div class="input-group input-group-alternative">
<input class="form-control" id="password_confirmation" placeholder="{{ __('Confirm Password') }}" type="password" name="password_confirmation" required>
</div>
<span
class="input-group-text border-0 position-absolute end-0 top-0 h-100 d-flex align-items-center"
style="cursor:pointer; z-index: 3; border-radius: 0 0.375rem 0.375rem 0; border-left: none; border: 1px solid #ced4da; background: transparent; padding: 0 12px; height: 100%; display: flex; align-items: center; box-shadow: none; top: 0; bottom: 0;"
onclick="togglePasswordVisibility('password_confirmation', 'eyeIcon-password_confirmation')"
tabindex="0"
aria-label="Toggle password visibility"
>
<svg id="eyeIcon-password_confirmation" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
</span>
</div>
<div class="text-center">
<button type="submit" class="btn bg-gradient-dark my-4" style="background: #4A4E59;">{{ __('Tetap Kata Laluan') }}</button>
</div>
</form>
<script>
function checkPasswordStrength() {
var number = /([0-9])/;
var alphabets = /([a-zA-Z])/;
var special_characters = /([~,!,@,#,$,%,^,&,*,-,_,+,=,?,>,<])/;
if ($('#password').val().length > 0 && $('#password').val().length < 6) {
$('#password-strength-status').removeClass();
$('#password-strength-status').addClass('text-danger font-weight-700');
$('#password-strength-status').html("Weak (should be atleast 6 characters.)");
} else if ($('#password').val().length == 0) {
$('#password-strength-status').removeClass();
$('#password-strength-status').addClass('text-muted font-weight-700');
$('#password-strength-status').html("None");
} else {
if ($('#password').val().match(number) && $('#password').val().match(alphabets) && $('#password').val().match(special_characters)) {
$('#password-strength-status').removeClass();
$('#password-strength-status').addClass('text-success font-weight-700');
$('#password-strength-status').html("Strong");
} else {
$('#password-strength-status').removeClass();
$('#password-strength-status').addClass('text-yellow font-weight-700');
$('#password-strength-status').html("Medium (should include alphabets, numbers and special characters.)");
}
}
}
function togglePasswordVisibility(inputId, iconId) {
const passwordInput = document.getElementById(inputId);
const eyeIcon = document.getElementById(iconId);
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeIcon.setAttribute('fill', '#12B652');
} else {
passwordInput.type = 'password';
eyeIcon.setAttribute('fill', '#6c757d');
}
}
</script>
@endsection