本文整理汇总了PHP中Confide::isThrottled方法的典型用法代码示例。如果您正苦于以下问题:PHP Confide::isThrottled方法的具体用法?PHP Confide::isThrottled怎么用?PHP Confide::isThrottled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Confide
的用法示例。
在下文中一共展示了Confide::isThrottled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
/**
* Attempt to do login
*
*/
public function postLogin()
{
$input = array('email' => Input::get('email'), 'username' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Get the value from the config file instead of changing the controller
if (Confide::logAttempt($input, Config::get('confide::signup_confirm'))) {
// Redirect the user to the URL they were trying to access before
// caught by the authentication filter IE Redirect::guest('user/login').
// Otherwise fallback to '/'
// Fix pull #145
return Redirect::intended('/users');
// change it to '/admin', '/dashboard' or something
} else {
$user = new User();
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::to('/')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例2: isThrottled
/**
* Checks if the credentials has been throttled by too
* much failed login attempts
*
* @param array $credentials Array containing the credentials (email/username and password)
*
* @return boolean Is throttled
*/
public function isThrottled($input)
{
return Confide::isThrottled($input);
}
示例3: do_login
/**
* Attempt to do login
*
*/
public function do_login()
{
$username = Input::get('login_email') . "@" . Input::get('nit');
$input = array('email' => Input::get('login_email'), 'username' => Input::get('login_email') . "@" . Input::get('nit'), 'password' => Input::get('login_password'), 'remember' => true);
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Get the value from the config file instead of changing the controller
if (Input::get('login_email') && Input::get('nit') && Confide::logAttempt($input, false)) {
Event::fire('user.login');
// Redirect the user to the URL they were trying to access before
// caught by the authentication filter IE Redirect::guest('user/login').
// Otherwise fallback to '/'
// Fix pull #145
if (Utils::isAdmin()) {
return Redirect::intended('/select_branch');
} else {
return Redirect::intended('/clients');
}
} else {
//$user = new User;
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = trans('texts.confide.too_many_attempts');
} else {
$err_msg = trans('texts.confide.wrong_credentials');
}
return Redirect::action('UserController@login')->withInput(Input::except('login_password'))->with('error', $err_msg);
}
// return Response::json($username);
}
示例4: postLogin
/**
* Attempt to do login
*
*/
public function postLogin()
{
$input = array('email' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Check that the user is confirmed.
if (Confide::logAttempt($input, true)) {
// added login activity
DB::update('UPDATE users SET last_login = ? WHERE id = ?', array(date('Y-m-d H:i:s', time()), Auth::user()->id));
$r = Session::get('loginRedirect');
if (!empty($r)) {
Session::forget('loginRedirect');
return Redirect::to($r);
}
return Redirect::to('/admin');
} else {
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($this->user->checkUserExists($input) && !$this->user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::to('user/login')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例5: postLogin
/**
* Attempt to do login
*
*/
public function postLogin()
{
$input = array('email' => Input::get('email'), 'username' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
$path = Input::get('oauth', '/user');
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Check that the user is confirmed.
if (Confide::logAttempt($input, true)) {
return Redirect::intended($path);
} else {
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($this->user->checkUserExists($input) && !$this->user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::to('user/login')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例6: login
public function login($input)
{
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
if (Confide::logAttempt($input, Config::get('confide::login_confirmed'))) {
$this->setToken();
return true;
} else {
$user = new User();
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return $err_msg;
}
}
示例7: postLogin
/**
* Attempt to do login
*
*/
public function postLogin()
{
$input = array('email' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
if (Confide::logAttempt($input, true)) {
DB::update('UPDATE users SET last_login = ? WHERE id = ?', array(date('Y-m-d H:i:s', time()), Auth::user()->id));
Activity::log(array('contentID' => Confide::user()->id, 'contentType' => 'login', 'description' => 'info', 'details' => gethostbyaddr($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] . ' (' . gethostbyaddr($_SERVER['REMOTE_ADDR']) . ')' : $_SERVER['REMOTE_ADDR'], 'updated' => Confide::user()->id ? true : false));
Event::fire('user.login', array($input));
$r = Session::get('loginRedirect');
if (!empty($r)) {
Session::forget('loginRedirect');
return Redirect::to($r);
}
return Redirect::to('/admin');
} else {
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($this->user->checkUserExists($input) && !$this->user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::to('user/login')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例8: do_login
public function do_login()
{
$username = Input::get('username');
$input = array('email' => Input::get('username'), 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
// get username from fetched data on DB
$fetched_user = User::whereUsername($username)->get();
foreach ($fetched_user as $key) {
$fetched_username = $key->username;
$status = $key->confirmed;
}
// Authenticate User
if (Confide::logAttempt($input)) {
// compare input username on fetched username
$result = strcmp($fetched_username, $username);
if ($result == 0) {
if ($status == 0) {
Confide::logout();
$err_msg2 = "Your account has been deactivated. Please contact authorized Personnel";
return Redirect::to('login')->withInput(Input::except('password'))->with('deactivated', $err_msg2);
}
return Redirect::intended('dashboard');
}
Confide::logout();
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
return Redirect::to('login')->withInput(Input::except('password'))->with('error', $err_msg);
} else {
$user = new User();
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::action('UserController@login')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例9: postLogin
public function postLogin()
{
$input = array('email' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
if (Confide::logAttempt($input, true)) {
return $this->user->updateLogin($input);
} else {
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($this->user->checkUserExists($input) && !$this->user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::to('user/login')->withInput(Input::except('password'))->with('error', $err_msg);
}
}
示例10: do_login
/**
* Log the user in
*/
public function do_login()
{
$rules = ['username' => 'required', 'password' => 'required'];
$validate = Hyfn::validate($rules);
if ($validate !== true) {
$user = new User();
return Redirect::to('login')->withInput(Input::except('password'))->withErrors($validate->errors());
}
$input = array('email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
// If you wish to only allow login from confirmed users, call logAttempt
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
if (Confide::logAttempt($input)) {
// If the session 'loginRedirect' is set, then redirect
// to that route. Otherwise redirect to '/'
$r = Session::get('loginRedirect');
if (!empty($r)) {
Session::forget('loginRedirect');
return Redirect::to($r);
}
return Redirect::to('/');
// change it to '/admin', '/dashboard' or something
} else {
$user = new User();
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
$user->validationErrors->add('login_error', $err_msg);
return Redirect::to('admin/login')->withInput(Input::except('password'))->with('error', true)->withErrors($user->errors());
}
}
示例11: socialLogin
public function socialLogin($action = "")
{
if ($action == "auth") {
// process authentication
try {
Hybrid_Endpoint::process();
} catch (Exception $e) {
// redirect back to http://URL/social/
return Redirect::route('hybridauth');
}
return;
}
try {
// create a HybridAuth object
$socialAuth = new Hybrid_Auth(app_path() . '/config/hybridauth.php');
if ($action == 'google') {
$provider = $socialAuth->authenticate("Google");
} else {
if ($action == 'facebook') {
$provider = $socialAuth->authenticate("facebook");
}
}
// fetch user profile
$userProfile = $provider->getUserProfile();
// logout
$provider->logout();
} catch (Exception $e) {
// exception codes can be found on HybBridAuth's web site
return $e->getMessage();
}
//check user to login or create new
$user = User::where('email', $userProfile->email)->first();
if (isset($user->email)) {
//can update user and login
$user->lastest_login = date("Y-m-d H:i:s");
if ($action == 'facebook' && empty($user->facebook_id)) {
$user->facebook_id = $userProfile->identifier;
$user->save();
} elseif ($action == 'google' && empty($user->google_id)) {
$user->google_id = $userProfile->identifier;
$user->save();
}
//return Redirect::to('/login')->with('notice',Lang::get('user_texts.social_is_exist'));
if (!empty($user->authy)) {
$authcontroller = new AuthController();
$auth_controller = $authcontroller->getAuthy();
$requestSms = $auth_controller->requestSms($user->authy);
// echo "<pre>errors: "; print_r($requestSms->errors()); echo "</pre>";
// echo "<pre>requestSms: "; print_r($requestSms); echo "</pre>";
if ($requestSms->ok()) {
//$notices = $requestSms->ok(); //return true
return Redirect::to('sms-verify')->with('authy_id', $user->authy)->with('user_login', $user->id);
} else {
//not_sent_token
$errors = $requestSms->errors();
return Redirect::to('login')->with('error', $errors->message);
}
} else {
Auth::login($user);
return Redirect::to('/');
}
} else {
//create new user and login
$user = new User();
$user->firstname = $userProfile->firstName;
$user->lastname = $userProfile->lastName;
$user->email = $userProfile->email;
$user->username = $userProfile->identifier;
$user->password = $userProfile->identifier;
$user->password_confirmation = $userProfile->identifier;
$user->banned = 0;
$user->confirmed = 1;
$user->referral = '';
$trade_key = md5($user->username . $user->email . time());
$user->trade_key = $trade_key;
$user->ip_lastlogin = $this->get_client_ip();
$user->lastest_login = date("Y-m-d H:i:s");
if ($action == 'facebook' && empty($user->facebook_id)) {
$user->facebook_id = $userProfile->identifier;
} elseif ($action == 'google' && empty($user->google_id)) {
$user->google_id = $userProfile->identifier;
}
$user->save();
// echo "<pre>user2" . print_r( $user->email, true ) . "</pre><br />";
if ($user->id) {
$user->addRole('User');
$input = array('email' => $userProfile->email, 'username' => $userProfile->email, 'password' => $userProfile->identifier, 'remember' => 0);
//login
if ($c = Confide::logAttempt($input, Config::get('confide::signup_confirm'))) {
return Redirect::to('/');
} else {
$user = new User();
// Check if there was too many login attempts
if (Confide::isThrottled($input)) {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
} elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
//.........这里部分代码省略.........