$user = $um->login($_rVar['form_loginname'], $_rVar['form_pw']); $status = $user->getStatus(); } } // Redirect user to the right page: // If the user is valid either because is just succeeded to login or because // she has a valid session, tries to redirect to the right value. This may happens // if you receive a mail with 2 docs to read. You click on both link and you get // 2 login forms. You identicate in the first tab and you reload the second one. // The reload (a /account/login.php?return_to=... url) should redirect you to the // doc instead of displaying login page again. if ($user === null) { $user = $um->getCurrentUser(); } if ($user->isLoggedIn()) { account_redirect_after_login(); } // // Display login page // // Display mode $pvMode = false; if ($_cVar['pv'] == 2) { $pvMode = true; } $presenter_builder = new User_LoginPresenterBuilder(); $presenter = $presenter_builder->build($_rVar['return_to'], $_cVar['pv'], $_rVar['form_loginname']); if ($pvMode) { $GLOBALS['HTML']->pv_header(array('title' => $presenter->account_login_page_title())); } else { $GLOBALS['HTML']->header(array('title' => $presenter->account_login_page_title()));
private function openSession(UserMapping $user_mapping) { $user = $this->user_manager->getUserById($user_mapping->getUserId()); try { $this->user_manager->openSessionForUser($user); } catch (User_LoginException $ex) { $this->redirectToLoginPageAfterFailure($ex->getMessage()); } catch (UserNotActiveException $ex) { $this->redirectToLoginPageAfterFailure($ex->getMessage()); } catch (SessionNotCreatedException $ex) { $this->redirectToLoginPageAfterFailure($ex->getMessage()); } \account_redirect_after_login(); }