app/Http/Controllers/Auth/AuthController.php
//now method disable ! Method need if we need second form to authorization by manager!
now method disable . Method need if we need second form to authorization by manager!
now method disable . Method need if we need second form to authorization by manager!
public function postLoginManager(Request $request){ 
        if ($request->isMethod('post')) {
            $throttles = $this->isUsingThrottlesLoginsTrait();
            if ($throttles && $this->hasTooManyLoginAttempts($request)) {
                return $this->sendLockoutResponse($request);
            }
            $messages = [ 
                'm_login.required' => 'Введите логин!',
                'm_pass.required' => 'Введите пароль!'
            ];
            $validator = Validator::make($request->all(), [
                'm_login' => 'required',
                'm_pass' => 'required'
            ], $messages);
            if ($validator->fails()) { 
                return redirect('auth/login')
                    ->withInput()
                    ->withErrors($validator); 
            } else {
                $userdata_email = array( 
                    'email'     => Input::get('m_login'),  
                    'password'  => Input::get('m_pass')
                );
                $userdata_name = array( 
                    'name'    => Input::get('l_email'),
                    'password'  => Input::get('l_pass')
                );
                if (Auth::attempt($userdata_email)) { 
                    if(Auth::attempt($userdata_email + ['active' => 1])) { 
                        if(Auth::user()->access == 1) {
                            Session::flash('user-info', Lang::get('message.auth.access_login')); 
                            return redirect('client/account');
                         } else {
                              $this->login_err_m = 'У вас нет прав!';
                         }
                    } else {
                        $this->login_err_m = Lang::get('error.auth.no_active');
                    }
                } else {
                    $this->login_err_m = Lang::get('error.login_pass_error');
                }
            }
            if ($throttles) {
                $this->incrementLoginAttempts($request);
            }
            return redirect('auth/login') 
            ->withInput($request->only($this->loginUsername(), 'remember'))
                ->withErrors([
                    $this->loginUsername() => $this->login_err_m,
                ]);
        } else {
            return redirect('/');
        }
    }
public function postLoginManager ( Request $ request ) { if ( $ request -> isMethod ( 'post' ) ) { $ throttles = $ this -> isUsingThrottlesLoginsTrait ( ) ; if ( $ throttles && $ this -> hasTooManyLoginAttempts ( $ request ) ) { return $ this -> sendLockoutResponse ( $ request ) ; } $ messages = [ 'm_login.required' => 'Введите логин!', 'm_pass.required' => 'Введите пароль!' ] ; $ validator = Validator :: make ( $ request -> all ( ) , [ 'm_login' => 'required' , 'm_pass' => 'required' ] , $ messages ) ; if ( $ validator -> fails ( ) ) { return redirect ( 'auth/login' ) -> withInput ( ) -> withErrors ( $ validator ) ; } else { $ userdata_email = array ( 'email' => Input :: get ( 'm_login' ) , 'password' => Input :: get ( 'm_pass' ) ) ; $ userdata_name = array ( 'name' => Input :: get ( 'l_email' ) , 'password' => Input :: get ( 'l_pass' ) ) ; if ( Auth :: attempt ( $ userdata_email ) ) { if ( Auth :: attempt ( $ userdata_email + [ 'active' => 1 ] ) ) { if ( Auth :: user ( ) -> access == 1 ) { Session :: flash ( 'user-info' , Lang :: get ( 'message.auth.access_login' ) ) ; return redirect ( 'client/account' ) ; } else { $ this -> login_err_m = 'У вас нет прав!'; } } else { $ this -> login_err_m = Lang :: get ( 'error.auth.no_active' ) ; } } else { $ this -> login_err_m = Lang :: get ( 'error.login_pass_error' ) ; } } if ( $ throttles ) { $ this -> incrementLoginAttempts ( $ request ) ; } return redirect ( 'auth/login' ) -> withInput ( $ request -> only ( $ this -> loginUsername ( ) , 'remember' ) ) -> withErrors ( [ $ this -> loginUsername ( ) => $ this -> login_err_m , ] ) ; } else { return redirect ( '/' ) ; } }
now method disable !
now method disable !
//login by manager (if need to do another login page for manager) // If the class is using the ThrottlesLogins trait, we can automatically throttle // the login attempts for this application. We'll key this by the username and // the IP address of the client making these requests into this application. //$credentials = $this->getCredentials($request); //validation message //$validator = Validator::make(Input::all(), $rules,$messages); //if true display error //set validation error name to display in error layout  views/common/errors.blade.php //login via email //email -> database row name //password -> database row name //login via name //print_r($userdata_email); //die(); /*$credentials*/ /* + ['active' => 1]*/ /*, $request->has('remember')*/ //avtive need to be 1 to check if user active account //check if user active account // echo Auth::user()-> access; // die(); //send message to user via flash data // if (Session::has('user_auth_mess')) { //if session isset redirect if no push data to session //return $this->handleUserWasAuthenticated($request, $throttles); //} else { //Session::push('user_auth_mess', $data);  //$data is an array and user is a session key. //   return $this->handleUserWasAuthenticated($request, $throttles); //} // If the login attempt was unsuccessful we will increment the number of attempts // to login and redirect the user back to the login form. Of course, when this // user surpasses their maximum number of attempts they will get locked out. //return redirect($this->loginPath()) //redirect to with message //$this->getFailedLoginMessage(), //message active account error