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'); }
<?php require_once dirname(__FILE__) . '/vendors/smf/smf_2_api.php'; require_once dirname(__FILE__) . '/vendors/smf/auth.php'; define("SMF_COOKIE_LEN", 4320); // 3 days if (isset($_REQUEST["username"])) { $username = rawurldecode($_REQUEST["username"]); $in = smfapi_login($username, SMF_COOKIE_LEN); if (!$in) { echo "<script type='text/javascript'>alert('Sorry! Failed to login to zhaohu forum! Please contact us and we would like to fix this for you!')</script>"; } } header("Location: {$_SERVER['HTTP_REFERER']}");
/** * @param array $data */ public function OnWebLogin(array $data) { if (!defined('SMF') || SMF != 'API') { return; } if (!smfapi_getUserByUsername($data['user']->username)) { if (!$this->addUserToSMF($data['user']->username)) { return; } } smfapi_login($data['user']->username, $data['attributes']['lifetime']); @session_write_close(); }
/** * Short description * * Long description * * @param * @return */ protected function login_user() { try { $this->loadApi(); } catch (Exception $e) { throw new \Exception($e->getMessage()); } $this->data = smfapi_login($this->identifier, $this->cookieLength); }