Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function loginAction(Request $request){
- if($request->getMethod() == 'POST'){
- $mail = $request->get('umail');
- $pass = $request->get('upass');
- $em = $this->getDoctrine()->getManager();
- $rep = $em->getRepository('SystemBundle:User');
- $user = $rep->findOneBy(array("email"=>$mail,"pass"=>$pass));
- if($user){
- $id = $user->getId();
- $type = $user->getType();
- $session = new Session();
- $session->start();
- $session->set('id',$id);
- $session->set('type',$type);
- if($type == "admin"){
- return $this->redirectToRoute('admin_homepage');
- }
- elseif ($type == "dis"){
- return $this->redirectToRoute('dis_homepage');
- }
- elseif ($type == "comp"){
- return $this->redirectToRoute('company_homepage');
- }
- }
- else{
- return new Response('not found where mail: '.$mail);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement