コード例 #1
0
ファイル: Auth.php プロジェクト: buggithubs/FreshRSS
 public static function makeCookie($username, $password_hash)
 {
     do {
         $conf = Minz_Configuration::get('system');
         $token = sha1($conf->salt . $username . uniqid(mt_rand(), true));
         $token_file = DATA_PATH . '/tokens/' . $token . '.txt';
     } while (file_exists($token_file));
     if (@file_put_contents($token_file, $username . "\t" . $password_hash) === false) {
         return false;
     }
     $expire = time() + 2629744;
     //1 month	//TODO: Use a configuration instead
     Minz_Session::setLongTermCookie('FreshRSS_login', $token, $expire);
     return $token;
 }