src/Towel/Controller/User.php
public function loginAction($request)
    {
        $data = $request->get('data');
        $userModel = new ModelUser();
        $validUser = $userModel->validateLogin($data['email'], $data['password']);

        if (!$validUser) {
            $this->setMessage('danger', 'Not valid user / password combination');
            return $this->redirect(url('login'));
        }

        $this->session()->set('user', $userModel->record);
        $this->sessionClearMessages();
        return $this->redirect('/');
    }
public function loginAction($request)
    {
        $data = $request->get('data');
        $userModel = new ModelUser();
        $validUser = $userModel->validateLogin($data['email'], $data['password']);

        if (!$validUser) {
            $this->setMessage('danger', 'Not valid user / password combination');
            return $this->redirect(url('login'));
        }

        $this->session()->set('user', $userModel->record);
        $this->sessionClearMessages();
        return $this->redirect('/');
    }
public function loginAction ( $ request ) { $ data = $ request -> get ( 'data' ) ; $ userModel = new ModelUser ( ) ; $ validUser = $ userModel -> validateLogin ( $ data [ 'email' ] , $ data [ 'password' ] ) ; if ( ! $ validUser ) { $ this -> setMessage ( 'danger' , 'Not valid user / password combination' ) ; return $ this -> redirect ( url ( 'login' ) ) ; } $ this -> session ( ) -> set ( 'user' , $ userModel -> record ) ; $ this -> sessionClearMessages ( ) ; return $ this -> redirect ( '/' ) ; }
Handles the login action.

@param $request

@return \Symfony\Component\HttpFoundation\RedirectResponse
Handles the login action .