Add Change PIN tool
This commit is contained in:
parent
5ed3420173
commit
ec2fac4ee4
11
action.php
11
action.php
@ -56,6 +56,17 @@ switch ($VARS['action']) {
|
||||
returnToSender("generic_op_error");
|
||||
}
|
||||
break;
|
||||
case "chpin":
|
||||
$error = [];
|
||||
if (!($VARS['newpin'] == "" || (is_numeric($VARS['newpin']) && strlen($VARS['newpin']) >= 1 && strlen($VARS['newpin']) <= 8))) {
|
||||
returnToSender("invalid_pin_format");
|
||||
}
|
||||
if ($VARS['newpin'] == $VARS['conpin']) {
|
||||
$database->update('accounts', ['pin' => ($VARS['newpin'] == "" ? null : $VARS['newpin'])], ['uid' => $_SESSION['uid']]);
|
||||
returnToSender("pin_updated");
|
||||
}
|
||||
returnToSender("new_pin_mismatch");
|
||||
break;
|
||||
case "add2fa":
|
||||
if (is_empty($VARS['secret'])) {
|
||||
returnToSender("invalid_parameters");
|
||||
|
27
apps/change_pin.php
Normal file
27
apps/change_pin.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
dieifnotloggedin();
|
||||
|
||||
$newpin = lang("new pin", false);
|
||||
$conpin = lang("confirm pin", false);
|
||||
$change = lang("change pin", false);
|
||||
$pinexp = lang("pin explanation", false);
|
||||
|
||||
|
||||
$APPS["change_pin"]["title"] = lang("change pin", false);
|
||||
$APPS["change_pin"]["icon"] = "th";
|
||||
$APPS["change_pin"]["content"] = <<<CONTENTEND
|
||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> $pinexp</div>
|
||||
<form action="action.php" method="POST">
|
||||
<input type="password" class="form-control" name="newpin" placeholder="$newpin" maxlength="8" pattern="[0-9]*" inputmode="numeric" />
|
||||
<input type="password" class="form-control" name="conpin" placeholder="$conpin" maxlength="8" pattern="[0-9]*" inputmode="numeric" />
|
||||
<input type="hidden" name="action" value="chpin" />
|
||||
<input type="hidden" name="source" value="security" />
|
||||
<br />
|
||||
<button type="submit" class="btn btn-success btn-sm btn-block">$change</button>
|
||||
</form>
|
||||
CONTENTEND;
|
@ -98,5 +98,12 @@ $STRINGS = [
|
||||
"secret key" => "Secret key",
|
||||
"label" => "Label",
|
||||
"issuer" => "Issuer",
|
||||
"no such code or code expired" => "That code is incorrect or expired."
|
||||
"no such code or code expired" => "That code is incorrect or expired.",
|
||||
"pin explanation" => "Change or set a login PIN for the Station kiosk Quick Access. PIN codes must be between one and eight digits.",
|
||||
"change pin" => "Change PIN",
|
||||
"new pin" => "New PIN",
|
||||
"confirm pin" => "New PIN (again)",
|
||||
"pin updated" => "PIN updated.",
|
||||
"new pin mismatch" => "The new PINs don't match each other.",
|
||||
"invalid pin format" => "PIN codes must be numeric and between one and eight digits in length.",
|
||||
];
|
||||
|
@ -60,5 +60,18 @@ define("MESSAGES", [
|
||||
"generic_op_error" => [
|
||||
"string" => "generic op error",
|
||||
"type" => "danger"
|
||||
],
|
||||
"pin_updated" => [
|
||||
"string" => "pin updated",
|
||||
"type" => "success"
|
||||
],
|
||||
"new_pin_mismatch" => [
|
||||
"string" => "new pin mismatch",
|
||||
"type" => "danger"
|
||||
],
|
||||
"invalid_pin_format" => [
|
||||
"string" => "invalid pin format",
|
||||
"type" => "danger"
|
||||
]
|
||||
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user