isLocked() public static method

public static isLocked ( $ip )
Ejemplo n.º 1
0
 public function login()
 {
     $ip = Request::getClientIp();
     if (LoginAttempt::isLocked($ip)) {
         return error_popup('your IP address is locked. Please wait a few minutes.');
     } else {
         $username = Request::input('username');
         $password = Request::input('password');
         $remember = Request::input('remember') === 'yes';
         Auth::attempt(['username' => $username, 'password' => $password], $remember);
         if (Auth::check()) {
             return Auth::user()->defaultJson();
         } else {
             LoginAttempt::failedAttempt($ip, $username);
             return error_popup('wrong password or username');
         }
     }
 }
Ejemplo n.º 2
0
 public function login()
 {
     $ip = Request::getClientIp();
     if (LoginAttempt::isLocked($ip)) {
         return error_popup("your IP address is locked. Please wait a few minutes.");
     } else {
         $username = Request::input("username");
         $password = Request::input("password");
         $remember = Request::input("remember") === "yes";
         Auth::attempt(['username' => $username, 'password' => $password], $remember);
         if (Auth::check()) {
             return Auth::user();
         } else {
             LoginAttempt::failedAttempt($ip, $username);
             return error_popup("wrong password or username");
         }
     }
 }
Ejemplo n.º 3
0
 public function login()
 {
     $ip = Request::getClientIp();
     if (LoginAttempt::isLocked($ip)) {
         return error_popup('your IP address is locked. Please wait a few minutes.');
     } else {
         $usernameOrEmail = Request::input('username');
         $user = User::where('username', $usernameOrEmail)->orWhere('user_email', $usernameOrEmail)->first();
         $password = Request::input('password');
         $remember = Request::input('remember') === 'yes';
         $validAuth = $user === null ? false : Auth::getProvider()->validateCredentials($user, compact('password'));
         if ($validAuth) {
             Request::session()->flush();
             Request::session()->regenerateToken();
             Auth::login($user, $remember);
             return ['header' => render_to_string('layout._header_user', ['_user' => Auth::user()]), 'header_popup' => render_to_string('layout._popup_user', ['_user' => Auth::user()]), 'user' => Auth::user()->defaultJson()];
         } else {
             LoginAttempt::failedAttempt($ip, $user);
             return error_popup('wrong password or email');
         }
     }
 }
Ejemplo n.º 4
0
Archivo: User.php Proyecto: ppy/osu-web
 public static function attemptLogin($user, $password, $ip = null)
 {
     $ip = $ip ?? Request::getClientIp() ?? '0.0.0.0';
     if (LoginAttempt::isLocked($ip)) {
         return trans('users.login.locked_ip');
     }
     $validAuth = $user === null ? false : Hash::check($password, $user->user_password);
     if (!$validAuth) {
         LoginAttempt::failedAttempt($ip, $user);
         return trans('users.login.failed');
     }
 }