public static function registerUser($input) { $User = new User(); $id = $User->insert_get_id(array('username' => $input['username'], 'password' => Hash::make($input['password']), 'validationkey' => $input['key'], 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'status' => 3, 'role' => $input['role'])); unset($input['username']); unset($input['password']); unset($input['role']); unset($input['key']); if ($id) { // $extension = File::extension($input['imgpath']['name']); // $directory = path('public').'avatar/'.sha1($id); // $filename = sha1($id.time()).".{$extension}"; // if($input['imgpath']['size'] != null){ // $upload_success = Input::upload('photo', $directory, $filename); // if( $upload_success ) { // $input['imgpath'] = 'avatar/'.sha1($id).'/'.$filename; // }else{ // $input['imgpath'] = ''; // } // }else{ // $input['imgpath'] = ''; // } $profile = new Profile(array('fullname' => $input['fullname'], 'icno' => $input['icno'], 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'emel' => $input['emel'])); $user = User::find($id); $user->userprofile()->insert($profile); Log::write('User', 'User ' . $input['icno'] . ' registered'); return $profile->exists; } else { Log::write('User', 'User ' . $input['icno'] . ' failed registered'); return false; } }
public static function auth($email, $pass) { // Get user by email. if (!($user = Users::get_by_email($email))) { return false; } // Make sure the password is correct. if (Hash::check($pass, $user['UsersPassword'])) { self::_do_user($user); Session::put('AccessToken', Users::get_access_token($user['UsersId'])); // Get the default AccountId \AcctsUsersLu::set_col('AcctsUsersLuUserId', $user['UsersId']); \AcctsUsersLu::set_order('AcctsUsersLuAcctId'); \AcctsUsersLu::set_limit(1); $lp = \AcctsUsersLu::get(); // Make sure we have at least one account. if (!isset($lp[0])) { return false; } // Set default account Session::put('AccountId', $lp[0]['AcctsUsersLuAcctId']); return true; } return false; }
/** * Attempt to log a user into the application. * * @param array $arguments * @return void */ public function attempt($arguments = array()) { $user = $this->get_user($arguments['username']); // This driver uses a basic username and password authentication scheme // so if the credentials mmatch what is in the database we will just // log the user into the application and remember them if asked. $password = $arguments['password']; if (!is_null($user) and Hash::check($password, $user->password)) { return $this->login($user->id, array_get($arguments, 'remember')); } return false; }
/** * Attempt to log a user into the application. * * @param array $arguments * @return void */ public function attempt($arguments = array()) { $user = $this->get_user($arguments); // If the credentials match what is in the database we will just // log the user into the application and remember them if asked. $password = $arguments['password']; $password_field = Config::get('auth.password', 'password'); if (!is_null($user) and Hash::check($password, $user->{$password_field})) { return $this->login($user->UsersId, array_get($arguments, 'remember')); } return false; }
/** * Implements IOAuth2Storage::checkClientCredentials(). * */ public function checkClientCredentials($client_id, $client_secret = NULL) { try { $client = \OAuth2Server\Models\Client::where_client_id($client_id)->first(); if ($client_secret === NULL) { return $client !== FALSE; } return \Laravel\Hash::check($client_secret . $client_id, $client->client_secret); } catch (PDOException $e) { $this->handleException($e); } }
/** * Attempt to log a user into the application. * * @param array $arguments * @return void */ public function attempt($arguments = array()) { $username = Config::get('auth.username'); $user = $this->model()->where($username, $arguments[$username])->first(); // This driver uses a basic username and password authentication scheme // so if the credentials match what is in the database we will just // log the user into the application and remember them if asked. $password = $arguments['password']; if (!is_null($user) and Hash::check($password, $user->password)) { return $this->login($user->_id, array_get($arguments, 'remember')); } return false; }
/** * Attempt to log a user into the application. * * @param array $arguments * @return void */ public function attempt($arguments = array()) { $user = $this->model()->where(function ($query) use($arguments) { $username = Config::get('admin::auth.username'); $query->where($username, '=', $arguments['username']); foreach (array_except($arguments, array('username', 'password', 'remember')) as $column => $val) { $query->where($column, '=', $val); } })->first(); // If the credentials match what is in the database we will just // log the user into the application and remember them if asked. $password = $arguments['password']; $password_field = Config::get('admin::auth.password', 'password'); if (!is_null($user) and Hash::check($password, $user->{$password_field})) { return $this->login($user->get_key(), array_get($arguments, 'remember')); } return false; }
public function attempt($arguments = array()) { $user = $this->get_user($arguments); $password = $arguments['password']; $password_field = Config::get('auth.password', 'password'); if (!is_null($user) and Hash::check($password, $user->{$password_field})) { return $this->login($user->id, array_get($arguments, 'remember')); } return false; }