Skip to content

Instantly share code, notes, and snippets.

@unisys12
Last active August 29, 2015 14:01
Show Gist options
  • Save unisys12/965bb317ee0898769d2d to your computer and use it in GitHub Desktop.
Save unisys12/965bb317ee0898769d2d to your computer and use it in GitHub Desktop.
My Phalcon UserController ...Just because I don't want to loose it
<?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