Apply validation to authentication form + update locale

This commit is contained in:
billz 2023-11-10 14:44:06 +00:00
parent ac339d16ef
commit e90f87ac63
2 changed files with 29 additions and 5 deletions

View file

@ -98,6 +98,18 @@ msgstr "New password"
msgid "Repeat new password" msgid "Repeat new password"
msgstr "Repeat new password" msgstr "Repeat new password"
msgid "Please provide a valid username."
msgstr "Please provide a valid username."
msgid "Please enter your old password."
msgstr "Please enter your old password."
msgid "Please enter a new password."
msgstr "Please enter a new password."
msgid "Please re-enter your new password."
msgstr "Please re-enter your new password."
#: includes/configure_client.php #: includes/configure_client.php
msgid "Client settings" msgid "Client settings"
msgstr "Client settings" msgstr "Client settings"

View file

@ -11,22 +11,28 @@
<div class="card-body"> <div class="card-body">
<?php $status->showMessages(); ?> <?php $status->showMessages(); ?>
<h4><?php echo _("Authentication settings") ;?></h4> <h4><?php echo _("Authentication settings") ;?></h4>
<form role="form" action="auth_conf" method="POST"> <form role="form" action="auth_conf" method="POST" class="needs-validation" novalidate>
<?php echo CSRFTokenFieldTag() ?> <?php echo CSRFTokenFieldTag() ?>
<div class="row"> <div class="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="username"><?php echo _("Username"); ?></label> <label for="username"><?php echo _("Username"); ?></label>
<input type="text" class="form-control" name="username" value="<?php echo htmlspecialchars($username, ENT_QUOTES); ?>"/> <input type="text" class="form-control" name="username" value="<?php echo htmlspecialchars($username, ENT_QUOTES); ?>" required />
<div class="invalid-feedback">
<?php echo _("Please provide a valid username."); ?>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<div class="mb-2"><?php echo _("Old password"); ?></div> <div class="mb-2"><?php echo _("Old password"); ?></div>
<div class="input-group"> <div class="input-group">
<input type="password" class="form-control" name="oldpass"/> <input type="password" class="form-control" name="oldpass" required />
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-light js-toggle-password" type="button" data-target="[name=oldpass]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button> <button class="btn btn-light js-toggle-password" type="button" data-target="[name=oldpass]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button>
</div> </div>
<div class="invalid-feedback">
<?php echo _("Please enter your old password."); ?>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -34,10 +40,13 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<div class="mb-2"><?php echo _("New password"); ?></div> <div class="mb-2"><?php echo _("New password"); ?></div>
<div class="input-group"> <div class="input-group">
<input type="password" class="form-control" name="newpass"/> <input type="password" class="form-control" name="newpass" required />
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-light js-toggle-password" type="button" data-target="[name=newpass]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button> <button class="btn btn-light js-toggle-password" type="button" data-target="[name=newpass]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button>
</div> </div>
<div class="invalid-feedback">
<?php echo _("Please enter a new password."); ?>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -45,10 +54,13 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<div class="mb-2"><?php echo _("Repeat new password"); ?></div> <div class="mb-2"><?php echo _("Repeat new password"); ?></div>
<div class="input-group"> <div class="input-group">
<input type="password" class="form-control" name="newpassagain"/> <input type="password" class="form-control" name="newpassagain" required />
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-light js-toggle-password" type="button" data-target="[name=newpassagain]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button> <button class="btn btn-light js-toggle-password" type="button" data-target="[name=newpassagain]" data-toggle-with="fas fa-eye-slash"><i class="fas fa-eye mx-2"></i></button>
</div> </div>
<div class="invalid-feedback">
<?php echo _("Please re-enter your new password."); ?>
</div>
</div> </div>
</div> </div>
</div> </div>