test theo
This commit is contained in:
@@ -134,8 +134,7 @@ class Login extends MY_Controller {
|
|||||||
for ($i = 1; $i < 7; $i ++){
|
for ($i = 1; $i < 7; $i ++){
|
||||||
$code .= rand(1,9);
|
$code .= rand(1,9);
|
||||||
}
|
}
|
||||||
$dateTime = new DateTime();
|
$asString = time();
|
||||||
$asString = $dateTime->format('Y-m-d H:i:s');
|
|
||||||
|
|
||||||
$this->Users_model->update_record(['twofactorcode' =>$code, 'twofactortime'=>$asString ],$userID);
|
$this->Users_model->update_record(['twofactorcode' =>$code, 'twofactortime'=>$asString ],$userID);
|
||||||
return $code;
|
return $code;
|
||||||
@@ -146,7 +145,7 @@ class Login extends MY_Controller {
|
|||||||
$tmpuserid = $this->session->userdata( 'tmpuserid' );
|
$tmpuserid = $this->session->userdata( 'tmpuserid' );
|
||||||
$code = $this->clean_input('code');
|
$code = $this->clean_input('code');
|
||||||
$hoe = $this->clean_input('hoe');
|
$hoe = $this->clean_input('hoe');
|
||||||
$user = $this->Users_model->get([],false,true);
|
$user = $this->Users_model->get($tmpuserid);
|
||||||
if ($hoe == "GOOGLE"){
|
if ($hoe == "GOOGLE"){
|
||||||
$message = $this->checkTwoFactorGoogle($user, $code);
|
$message = $this->checkTwoFactorGoogle($user, $code);
|
||||||
}
|
}
|
||||||
@@ -160,9 +159,9 @@ class Login extends MY_Controller {
|
|||||||
|
|
||||||
function checkTwoFactorEmail($user,$code){
|
function checkTwoFactorEmail($user,$code){
|
||||||
$message = false;
|
$message = false;
|
||||||
$now = strtotime('-10 minutes');
|
$now = time() - (10 * 60);
|
||||||
$test = strtotime($user->twofactortime);
|
$test = $user->twofactortime;
|
||||||
if ($now > strtotime($user->twofactortime) )
|
if ($now > $test )
|
||||||
$message = "U heeft te lang gewacht, de code is niet meer geldig.";
|
$message = "U heeft te lang gewacht, de code is niet meer geldig.";
|
||||||
else
|
else
|
||||||
if ($user->twofactorcode !== $code) $message = "Code is incorrect.";
|
if ($user->twofactorcode !== $code) $message = "Code is incorrect.";
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class MY_Model extends CI_Model{
|
|||||||
|
|
||||||
if ( $fieldname ) $this->db->select( $fieldname );
|
if ( $fieldname ) $this->db->select( $fieldname );
|
||||||
$query = $this->db->get( $this->tablename . ' AS T1' );
|
$query = $this->db->get( $this->tablename . ' AS T1' );
|
||||||
if ( $query->num_rows() == 0 ) return FALSE;
|
if ( ! $query || $query->num_rows() == 0 ) return FALSE;
|
||||||
|
|
||||||
if ( $row ){
|
if ( $row ){
|
||||||
$row = $query->row();
|
$row = $query->row();
|
||||||
|
|||||||
Reference in New Issue
Block a user