コード例 #1
0
ファイル: login.php プロジェクト: sadr110/webtrees
     Log::addAuthenticationLog('Login failed (no such user/email): ' . $username);
     throw new Exception(WT_I18N::translate('The username or password is incorrect.'));
 }
 if (!$user->checkPassword($password)) {
     Log::addAuthenticationLog('Login failed (incorrect password): ' . $username);
     throw new Exception(WT_I18N::translate('The username or password is incorrect.'));
 }
 if (!$user->getSetting('verified')) {
     Log::addAuthenticationLog('Login failed (not verified by user): ' . $username);
     throw new Exception(WT_I18N::translate('This account has not been verified.  Please check your email for a verification message.'));
 }
 if (!$user->getSetting('verified_by_admin')) {
     Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username);
     throw new Exception(WT_I18N::translate('This account has not been approved.  Please wait for an administrator to approve it.'));
 }
 Auth::login($user);
 Log::addAuthenticationLog('Login: '******'/' . Auth::user()->getRealName());
 $WT_SESSION->timediff = $timediff;
 $WT_SESSION->locale = Auth::user()->getSetting('language');
 $WT_SESSION->theme_dir = Auth::user()->getSetting('theme');
 // If we’ve clicked login from the login page, we don’t want to go back there.
 if (strpos($url, WT_SCRIPT_NAME) === 0) {
     $url = '';
 }
 // We're logging in as an administrator
 if (Auth::isAdmin()) {
     // Check for updates
     $latest_version_txt = fetch_latest_version();
     if (preg_match('/^[0-9.]+\\|[0-9.]+\\|/', $latest_version_txt)) {
         list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt);
         if (version_compare(WT_VERSION, $latest_version) < 0) {
コード例 #2
0
ファイル: module.php プロジェクト: elRadix/webtrees-facebook
 private function login($user_id)
 {
     global $WT_SESSION;
     $user = User::find($user_id);
     $user_name = $user->getUserName();
     // Below copied from authenticateUser in authentication.php
     $is_admin = $user->getPreference('canadmin');
     $verified = $user->getPreference('verified');
     $approved = $user->getPreference('verified_by_admin');
     if ($verified && $approved || $is_admin) {
         Auth::login($user);
         Log::addAuthenticationLog('Login: '******'/' . Auth::user()->getRealName());
         $WT_SESSION->locale = Auth::user()->getPreference('language');
         $WT_SESSION->theme_dir = Auth::user()->getPreference('theme');
         $WT_SESSION->activity_time = WT_TIMESTAMP;
         $user->setPreference('sessiontime', WT_TIMESTAMP);
         Zend_Session::writeClose();
         return $user_id;
     } elseif (!$is_admin && !$verified) {
         Log::addAuthenticationLog('Login failed ->' . $user_name . '<- not verified');
         return -1;
     } elseif (!$is_admin && !$approved) {
         Log::addAuthenticationLog('Login failed ->' . $user_name . '<- not approved');
         return -2;
     }
     throw new Exception('Login failure: Unexpected condition');
 }