예제 #1
0
 public function logout()
 {
     $user = Models\User::getCurrent();
     if ($user instanceof Models\User) {
         TigerApp::log("Logout for {$user->username}");
     }
     Session::dispose('user');
     $this->slim->response()->redirect("/login");
 }
예제 #2
0
 /**
  * @param $username
  * @param $password
  * @return bool
  */
 public function doLogin($username, $password)
 {
     // Support logging in with email address
     $user = Models\User::search()->where('email', $username)->execOne();
     // Support logging in with username
     if (!$user instanceof Models\User) {
         $user = Models\User::search()->where('username', $username)->execOne();
     }
     if (!$user instanceof Models\User) {
         TigerApp::log("No such user {$username}", Slim\Log::WARN);
         return false;
     } elseif ($user->checkPassword($password)) {
         Session::set("user", $user);
         return true;
     } else {
         TigerApp::log("Failed login for {$username}", Slim\Log::WARN);
         return false;
     }
 }
예제 #3
0
파일: User.php 프로젝트: Thruio/TigerKit
 public function save($automatic_reload = true)
 {
     if (!$this->user_uuid) {
         $this->user_uuid = UUID::v4();
     }
     if (!$this->user_id) {
         TigerApp::log("New user created: {$this->username} / {$this->displayname} / {$this->email}");
     }
     return parent::save($automatic_reload);
 }
예제 #4
0
 /**
  * @param string $key
  * @return string|array|false
  */
 public static function Config($key)
 {
     $indexes = explode(".", $key);
     $configData = self::$tigerApp->config;
     foreach ($indexes as $index) {
         if (isset($configData[$index])) {
             $configData = $configData[$index];
         } else {
             TigerApp::log("No such config index: {$key}");
             return false;
         }
     }
     return $configData;
 }