Last active
August 29, 2015 14:01
-
-
Save unisys12/965bb317ee0898769d2d to your computer and use it in GitHub Desktop.
My Phalcon UserController ...Just because I don't want to loose it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersController extends ControllerBase{ | |
public function IndexAction() | |
{ | |
//Displays Classic Style Form at domain.dev/users | |
} | |
public function ClassFormAction() | |
{ | |
$form = new LoginForm(); | |
$this->view->form = $form; | |
} | |
public function loginAction() | |
{ | |
$username = $this->request->getPost('username'); | |
$password = $this->request->getPost('password'); | |
if($this->security->checkToken()){ | |
$user = Users::findFirstByUsername($username); | |
if( !$user ){ | |
$this->flashSession->error('User ' . $username . ' not found!'); | |
return $this->response->redirect('users'); | |
} | |
if ( !password_verify($password, $user->password)){ | |
$this->flashSession->error('Password entered does not match or records for user ' . $username); | |
return $this->response->redirect('users'); | |
} | |
return $this->response->redirect(); | |
} else { | |
return $this->flash->error('You must pay the boatman with a token to get across!'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment