Guest User

Untitled

a guest
Aug 11th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2. protected function processForm(sfWebrequest $request, sfForm $form)
  3. {
  4. $form->bind(
  5. $request->getParameter($form->getName())
  6. );
  7. if ($form->isValid())
  8. {
  9. $formValues = $form->getValues();
  10.  
  11. $login = $formValues['login'];
  12. $password = $formValues['password'];
  13.  
  14. $User = Doctrine::getTable('User')->findOneByLogin($login);
  15.  
  16. if(!$User) $this->redirect('@homepage');
  17.  
  18. if($User->password == $password)
  19. {
  20. $currentUserId = $User->id;
  21. $this->getUser()->setAuthenticated(true);
  22. $this->getUser()->addCredential('user');
  23. $this->getUser()->setAttribute('currentUserId', $currentUserId);
  24.  
  25. $this->redirect('home/index');
  26. }
  27. else $this->redirect('@homepage);
  28. }
  29. }
Add Comment
Please, Sign In to add comment