public function createAuthCode() { // Save random auth code in users meta data $authcode = Crypt::hash("random:authcode:" . DateManager::now() . ":" . rand()); Meta::remove("user", $this->id, "authcode"); Meta::save("user", $this->id, "authcode", Crypt::createHash($authcode)); }