[UPDATE] Coding style
This commit is contained in:
parent
4c3421cc8a
commit
67a6d9aff4
@ -172,7 +172,7 @@ public function generatePin($userID, $current) {
|
|||||||
$username = $this->getUserName($userID);
|
$username = $this->getUserName($userID);
|
||||||
$email = $this->getUserEmail($username);
|
$email = $this->getUserEmail($username);
|
||||||
$current = $this->getHash($current);
|
$current = $this->getHash($current);
|
||||||
$newpin = intval( "0" . rand(1,9) . rand(0,9) . rand(0,9) . rand(0,9) );
|
$newpin = intval( '0' . rand(1,9) . rand(0,9) . rand(0,9) . rand(0,9) );
|
||||||
$aData['username'] = $username;
|
$aData['username'] = $username;
|
||||||
$aData['email'] = $email;
|
$aData['email'] = $email;
|
||||||
$aData['pin'] = $newpin;
|
$aData['pin'] = $newpin;
|
||||||
@ -180,8 +180,7 @@ public function generatePin($userID, $current) {
|
|||||||
$aData['subject'] = 'PIN Reset Request';
|
$aData['subject'] = 'PIN Reset Request';
|
||||||
$stmt = $this->mysqli->prepare("UPDATE $this->table SET pin = ? WHERE ( id = ? AND pass = ? )");
|
$stmt = $this->mysqli->prepare("UPDATE $this->table SET pin = ? WHERE ( id = ? AND pass = ? )");
|
||||||
|
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('sis', $newpin, $userID, $current) && $stmt->execute())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('sis', $newpin, $userID, $current) && $stmt->execute()) {
|
||||||
{
|
|
||||||
if ($stmt->errno == 0 && $stmt->affected_rows === 1) {
|
if ($stmt->errno == 0 && $stmt->affected_rows === 1) {
|
||||||
if ($this->mail->sendMail('pin/reset', $aData)) {
|
if ($this->mail->sendMail('pin/reset', $aData)) {
|
||||||
return true;
|
return true;
|
||||||
@ -190,7 +189,6 @@ public function generatePin($userID, $current) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
}
|
}
|
||||||
$this->setErrorMessage( 'Unable to generate PIN, current password incorrect?' );
|
$this->setErrorMessage( 'Unable to generate PIN, current password incorrect?' );
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -5,14 +5,14 @@ if (!defined('SECURITY'))
|
|||||||
die('Hacking attempt');
|
die('Hacking attempt');
|
||||||
|
|
||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
if (isset($_POST['do']) && $_POST['do'] == 'genPin') {
|
if (isset($_POST['do']) && $_POST['do'] == 'genPin') {
|
||||||
if ($user->generatePin($_SESSION['USERDATA']['id'], $_POST['currentPassword'])) {
|
if ($user->generatePin($_SESSION['USERDATA']['id'], $_POST['currentPassword'])) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Your PIN # has been sent to your email.', 'TYPE' => 'success');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Your PIN # has been sent to your email.', 'TYPE' => 'success');
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => $user->getError(), 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => $user->getError(), 'TYPE' => 'errormsg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( @$_POST['do'] && (! $user->checkPin($_SESSION['USERDATA']['id'], @$_POST['authPin']))) {
|
if ( @$_POST['do'] && (! $user->checkPin($_SESSION['USERDATA']['id'], @$_POST['authPin']))) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN. ' . ($config['maxfailed']['pin'] - $user->getUserPinFailed($_SESSION['USERDATA']['id'])) . ' attempts remaining.', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN. ' . ($config['maxfailed']['pin'] - $user->getUserPinFailed($_SESSION['USERDATA']['id'])) . ' attempts remaining.', 'TYPE' => 'errormsg');
|
||||||
} else {
|
} else {
|
||||||
@ -56,7 +56,7 @@ else {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tempalte specifics
|
// Tempalte specifics
|
||||||
$smarty->assign("CONTENT", "default.tpl");
|
$smarty->assign("CONTENT", "default.tpl");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user