Example #1
0
 /**
  * Generates the code associated with this invitation
  */
 function generateCode()
 {
     $token = new \Idno\Core\TokenProvider();
     $this->code = $token->generateHexToken(16);
 }
Example #2
0
 /**
  * Add a password recovery code to the user
  * @return string The new recovery code, suitable for sending in an email
  */
 function addPasswordRecoveryCode()
 {
     $token = new \Idno\Core\TokenProvider();
     $auth_code = bin2hex($token->generateToken(16));
     $this->password_recovery_code = $auth_code;
     $this->password_recovery_code_time = time();
     return $auth_code;
 }
Example #3
0
 /**
  * Generate a semi-random API key for this user, and then return it
  * @return string
  */
 function generateAPIkey()
 {
     $token = new \Idno\Core\TokenProvider();
     $apikey = strtolower(substr(base64_encode($token->generateToken(32)), 12, 16));
     $this->apikey = $apikey;
     $this->save();
     return $apikey;
 }