/** * @see org.opencms.jsp.CmsJspLoginBean#getFormLink() */ @Override public String getFormLink() { if (getPreDefOuFqn() == null) { return super.getFormLink(); } return link("/system/login" + (String)getRequest().getAttribute(PARAM_PREDEF_OUFQN)); }
/** * @see org.opencms.jsp.CmsJspLoginBean#getFormLink() */ @Override public String getFormLink() { if (getPreDefOuFqn() == null) { return super.getFormLink(); } String preDefOuFqn = (String)getRequest().getAttribute(PARAM_PREDEF_OUFQN); try { OpenCms.getOrgUnitManager().readOrganizationalUnit(getCmsObject(), preDefOuFqn); } catch (CmsException e) { // organizational unit does not exist return super.getFormLink(); } return link("/system/login" + CmsEncoder.escapeXml(preDefOuFqn)); }
/** * Logs a system user in to OpenCms.<p> * * Note that if a login project name is provided, this project must exist, * otherwise the login is regarded as a failure even if the user data was correct.<p> * * @param userName the users name * @param password the password * @param projectName the project to switch to after login (if null project is not switched) * @param redirectUri the URI to redirect to after login (if null the current URI is used) * * @throws IOException in case redirect after login was not successful */ public void login(String userName, String password, String projectName, String redirectUri) throws IOException { login(userName, password, projectName); if (m_loginException == null) { if (redirectUri != null) { getResponse().sendRedirect( OpenCms.getLinkManager().substituteLink(getCmsObject(), redirectUri, null, true)); } else { getResponse().sendRedirect(getFormLink()); } } }
/** * Logs a system user in to OpenCms.<p> * * Note that if a login project name is provided, this project must exist, * otherwise the login is regarded as a failure even if the user data was correct.<p> * * @param userName the users name * @param password the password * @param projectName the project to switch to after login (if null project is not switched) * @param redirectUri the URI to redirect to after login (if null the current URI is used) * * @throws IOException in case redirect after login was not successful */ public void login(String userName, String password, String projectName, String redirectUri) throws IOException { login(userName, password, projectName); if (m_loginException == null) { if (redirectUri != null) { getResponse().sendRedirect( OpenCms.getLinkManager().substituteLink(getCmsObject(), redirectUri, null, true)); } else { getResponse().sendRedirect(getFormLink()); } } }
/** * Logs a user out, i.e. destroys the current users session, * after that the current page will be redirected to itself one time to ensure that * the users session is truly destroyed.<p> * * @throws IOException if redirect after logout fails */ public void logout() throws IOException { HttpSession session = getRequest().getSession(false); if (session != null) { session.invalidate(); } // logout was successful if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key( Messages.LOG_LOGOUT_SUCCESFUL_3, getRequestContext().currentUser().getName(), getRequestContext().addSiteRoot(getRequestContext().getUri()), getRequestContext().getRemoteAddress())); } getResponse().sendRedirect(getFormLink()); } }
/** * Logs a user out, i.e. destroys the current users session, * after that the current page will be redirected to itself one time to ensure that * the users session is truly destroyed.<p> * * @throws IOException if redirect after logout fails */ public void logout() throws IOException { String loggedInUserName = getRequestContext().getCurrentUser().getName(); HttpSession session = getRequest().getSession(false); if (session != null) { session.invalidate(); /* we need this because a new session might be created after this method, but before the session info is updated in OpenCmsCore.showResource. */ getCmsObject().getRequestContext().setUpdateSessionEnabled(false); } // logout was successful if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_LOGOUT_SUCCESFUL_3, loggedInUserName, getRequestContext().addSiteRoot(getRequestContext().getUri()), getRequestContext().getRemoteAddress())); } getResponse().sendRedirect(getFormLink()); } }