Skip to content

Commit

Permalink
password input validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alfian8752 committed Nov 21, 2024
1 parent 9231d9c commit 26326c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
18 changes: 13 additions & 5 deletions resources/views/admin/pages/profile/panes/tab-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,29 @@
<div class="row mt-4">
<div class="col-lg-12 mb-3">
<label for="" class="form-label">Password Lama:</label>
<input type="password" class="form-control old_password" id="name" placeholder="Password Lama" name="old_password">
<input type="password" class="form-control old_password" id="name" placeholder="Password Lama"
name="old_password">
<div class="invalid-feedback"></div>
</div>
<div class="col-lg-12 mb-3">
<label for="" class="form-label">Password Baru:</label>
<input type="password" class="form-control password" id="email" placeholder="Password Baru" name="password">
<input type="password" class="form-control password" id="email" placeholder="Password Baru"
name="password">
<div class="invalid-feedback"></div>
</div>
<div class="col-lg-12 mb-3">
<label for="" class="form-label">Konfirmasi Password:</label>
<input type="password" class="form-control password_confirmation" id="password_confirmation" placeholder="Konfirmasi Password" name="password_confirmation">
<input type="password" class="form-control password_confirmation" id="password_confirmation"
placeholder="Konfirmasi Password" name="password_confirmation">
<div class="invalid-feedback"></div>
</div>
</div>
<div class="text-end">
<button type="reset" id="cancel-reset-btn" class="btn text-white" style="background-color: #DB0909;">Batal</button>
<button type="reset" id="cancel-reset-btn" class="btn text-white"
style="background-color: #DB0909;">Batal</button>
<button type="submit" id="save-profile-btn" class="btn text-white ms-2" style="background-color: #9425FE;">
<svg xmlns="http://www.w3.org/2000/svg" class="me-2" width="15" height="18" viewBox="0 0 28 28">
<svg xmlns="http://www.w3.org/2000/svg" class="me-2" width="15" height="18"
viewBox="0 0 28 28">
<path fill="currentColor"
d="M19.289 3.15a3.932 3.932 0 1 1 5.56 5.56l-1.54 1.54l-5.56-5.56zm-2.6 2.6L4.502 17.937c-.44.44-.76.986-.928 1.586l-1.547 5.525a.75.75 0 0 0 .924.924l5.524-1.547a3.6 3.6 0 0 0 1.587-.928L22.25 11.311z" />
</svg>
Expand Down
21 changes: 11 additions & 10 deletions resources/views/admin/pages/profile/scripts/edit-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@
if (errors) {
for (let key in errors) {
if (errors.hasOwnProperty(key)) {
if (key == 'description') {
let feedback = $(`.invalid-feedback`).closest(
`.${key}`);
feedback.text(errors[key])
feedback.removeClass('d-none')
} else {
$(`#${key}`).addClass('is-invalid')
.closest('.invalid-feedback').text(errors[key]);
}
// if (key == 'description') {
let feedback = $(`.invalid-feedback`).closest(
`.${key}`);
feedback.text(errors[key])
feedback.removeClass('d-none')
// } else {
$(`input[name="${key}"]`).addClass('is-invalid').closest('.invalid-feedback').text(errors[key]);
console.log($(`input[name="${key}"]`).addClass('is-invalid').closest('.invalid-feedback'));
// }
}
}
}
}
});
});
});
</script>
</script>

0 comments on commit 26326c8

Please sign in to comment.