|
|
|
@ -166,23 +166,18 @@ function homeInfo($user)
|
|
|
|
|
if ($rep === false) |
|
|
|
|
$ans = false; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
$ans = repDecode($rep); |
|
|
|
|
// if ($ans['lastblock'] == '?') |
|
|
|
|
// { |
|
|
|
|
// $ans['lastblock'] = 1401237522; |
|
|
|
|
// $ans['lastblock'] = 1403819191; |
|
|
|
|
// $ans['lastblock'] = 1407113822; |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $ans; |
|
|
|
|
} |
|
|
|
|
# |
|
|
|
|
function checkPass($user, $pass) |
|
|
|
|
function checkPass($user, $pass, $twofa) |
|
|
|
|
{ |
|
|
|
|
$passhash = myhash($pass); |
|
|
|
|
$flds = array('username' => $user, 'passwordhash' => $passhash); |
|
|
|
|
if ($twofa === null) |
|
|
|
|
$twofa = ''; |
|
|
|
|
$flds = array('username' => $user, 'passwordhash' => $passhash, |
|
|
|
|
'2fa' => $twofa); |
|
|
|
|
$msg = msgEncode('chkpass', 'chkpass', $flds, $user); |
|
|
|
|
$rep = sendsockreply('checkPass', $msg); |
|
|
|
|
if (!$rep) |
|
|
|
@ -190,11 +185,14 @@ function checkPass($user, $pass)
|
|
|
|
|
return $rep; |
|
|
|
|
} |
|
|
|
|
# |
|
|
|
|
function setPass($user, $oldpass, $newpass) |
|
|
|
|
function setPass($user, $oldpass, $newpass, $twofa) |
|
|
|
|
{ |
|
|
|
|
$oldhash = myhash($oldpass); |
|
|
|
|
$newhash = myhash($newpass); |
|
|
|
|
$flds = array('username' => $user, 'oldhash' => $oldhash, 'newhash' => $newhash); |
|
|
|
|
if ($twofa === null) |
|
|
|
|
$twofa = ''; |
|
|
|
|
$flds = array('username' => $user, 'oldhash' => $oldhash, |
|
|
|
|
'newhash' => $newhash, '2fa' => $twofa); |
|
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
|
$rep = sendsockreply('setPass', $msg); |
|
|
|
|
if (!$rep) |
|
|
|
@ -202,10 +200,12 @@ function setPass($user, $oldpass, $newpass)
|
|
|
|
|
return repDecode($rep); |
|
|
|
|
} |
|
|
|
|
# |
|
|
|
|
function resetPass($user, $newpass) |
|
|
|
|
function resetPass($user, $newpass, $twofa) |
|
|
|
|
{ |
|
|
|
|
$newhash = myhash($newpass); |
|
|
|
|
$flds = array('username' => $user, 'newhash' => $newhash); |
|
|
|
|
if ($twofa === null) |
|
|
|
|
$twofa = ''; |
|
|
|
|
$flds = array('username' => $user, 'newhash' => $newhash, '2fa' => $twofa); |
|
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
|
$rep = sendsockreply('resetPass', $msg); |
|
|
|
|
if (!$rep) |
|
|
|
@ -216,7 +216,8 @@ function resetPass($user, $newpass)
|
|
|
|
|
function userReg($user, $email, $pass) |
|
|
|
|
{ |
|
|
|
|
$passhash = myhash($pass); |
|
|
|
|
$flds = array('username' => $user, 'emailaddress' => $email, 'passwordhash' => $passhash); |
|
|
|
|
$flds = array('username' => $user, 'emailaddress' => $email, |
|
|
|
|
'passwordhash' => $passhash); |
|
|
|
|
$msg = msgEncode('adduser', 'reg', $flds, $user); |
|
|
|
|
$rep = sendsockreply('userReg', $msg); |
|
|
|
|
if (!$rep) |
|
|
|
|