Beispiel #1
0
function auth()
{
    $u = getUsername();
    $p = getPassword();
    if (!trim($u) || !trim($p)) {
        return false;
    }
    return smfapi_authenticate(trim($u), trim($p), true);
}
Beispiel #2
0
 public function index()
 {
     session_start();
     $user = Input::get('username');
     $pass = Input::get('password');
     require_once User::getSmfApiPath();
     if (Request::isMethod('post')) {
         $sanitize = new Sanitizer(Input::all());
         Input::merge($sanitize->get());
         if (smfapi_authenticate($user, $pass) == true) {
             smfapi_login($user);
             $userModel = User::where('member_name', $user)->orWhere('email_address', $user)->first();
             // $userModel->is_admin = $user_info['is_admin']; // We don't work :(
             // $userModel->avatar = $user_info['avatar'];
             // Whatever is set manually, must be unset manually too
             Session::set('is_admin', $user_info['is_admin']);
             Session::set('posts', $user_info['posts']);
             Auth::login($userModel);
             return Redirect::route('admin');
         }
         return View::make('layouts.admin.guest')->with('global_error', 'Грешно име или парола!');
     }
     return View::make('layouts.admin.guest');
 }
 /**
  * Short description
  *
  * Long description
  *
  * @param
  * @return
  */
 protected function authenticate_user()
 {
     try {
         $this->loadApi();
     } catch (Exception $e) {
         throw new \Exception($e->getMessage());
     }
     $this->data = smfapi_authenticate($this->username, $this->password, $this->encrypted);
 }