コード例 #1
0
  /**
   * @see org.olat.login.auth.AuthenticationController#init(org.olat.core.gui.UserRequest,
   *     org.olat.core.gui.control.WindowControl)
   */
  public OLATAuthenticationController(UserRequest ureq, WindowControl winControl) {
    // use fallback translator to registration module
    super(
        ureq,
        winControl,
        Util.createPackageTranslator(RegistrationManager.class, ureq.getLocale()));

    loginComp = createVelocityContainer("olat_log", "olatlogin");

    if (userModule.isAnyPasswordChangeAllowed()) {
      pwLink = LinkFactory.createLink("_olat_login_change_pwd", "menu.pw", loginComp, this);
      pwLink.setElementCssClass("o_login_pwd");
    }

    if (registrationModule.isSelfRegistrationEnabled()
        && registrationModule.isSelfRegistrationLoginEnabled()) {
      registerLink =
          LinkFactory.createLink("_olat_login_register", "menu.register", loginComp, this);
      registerLink.setElementCssClass("o_login_register");
      registerLink.setTitle("menu.register.alt");
    }

    // prepare login form
    loginForm = new OLATAuthentcationForm(ureq, winControl, "olat_login", getTranslator());
    listenTo(loginForm);

    loginComp.put("loginForm", loginForm.getInitialComponent());

    // Check if form is triggered by external loginworkflow that has been failed
    if (ureq.getParameterSet().contains(PARAM_LOGINERROR)) {
      showError(translate("login.error", WebappHelper.getMailConfig("mailReplyTo")));
    }

    putInitialPanel(loginComp);
  }
コード例 #2
0
  @Override
  public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) return;

    ContextEntry entry = entries.get(0);
    String type = entry.getOLATResourceable().getResourceableTypeName();
    if ("changepw".equals(type)) {
      String email = null;
      if (entries.size() > 1) {
        email = entries.get(1).getOLATResourceable().getResourceableTypeName();
      }
      openChangePassword(ureq, email);
    } else if ("registration".equals(type)) {
      if (registrationModule.isSelfRegistrationEnabled()
          && registrationModule.isSelfRegistrationLinkEnabled()) {
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        openRegistration(ureq).activate(ureq, subEntries, entry.getTransientState());
      }
    }
  }