Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-4224

Self registration is not possible

    XMLWordPrintable

    Details

      Description

      Self registration does not work. The error message when sending the registration form is:

      The cause is that the email is check if it's valid. This is done by the property handler where the user manager is called. There the email is checked if it's not in use. The result is true because the email is stored in the temporary key.

      This patch fixes that for us now, but perhaps there is a case I haven't had in mind:

      diff --git a/src/main/java/org/olat/registration/RegistrationForm2.java b/src/main/java/org/olat/registration/RegistrationForm2.java
      index 1dde3a4..0f685a2 100644
      --- a/src/main/java/org/olat/registration/RegistrationForm2.java
      +++ b/src/main/java/org/olat/registration/RegistrationForm2.java
      @@ -53,6 +53,7 @@
       import org.olat.login.validation.ValidationResult;
       import org.olat.user.ChangePasswordForm;
       import org.olat.user.UserManager;
      +import org.olat.user.propertyhandlers.EmailProperty;
       import org.olat.user.propertyhandlers.UserPropertyHandler;
       import org.springframework.beans.factory.annotation.Autowired;
       
      @@ -87,6 +88,8 @@
       	private UserManager userManager;
       	@Autowired
       	private OLATAuthManager olatAuthManager;
      +	@Autowired
      +	private RegistrationManager registrationManager;
       
       	public RegistrationForm2(UserRequest ureq, WindowControl wControl, String languageKey, String proposedUsername,
       			String email, boolean userInUse, boolean usernameReadonly) {
      @@ -237,8 +240,11 @@
       		// validate each user field
       		for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
       			FormItem fi = propFormItems.get(userPropertyHandler.getName());
      -			if (!userPropertyHandler.isValid(null, fi, null)) {
      -				allOk &= false;
      +			if (fi.isEnabled() && !userPropertyHandler.isValid(null, fi, null)) {
      +				if (userPropertyHandler instanceof EmailProperty)
      +					allOk &= registrationManager.isEmailReserved(getEmail());
      +				else
      +					allOk &= false;
       			}
       		}
       

      A also think that the validity of a property should not be checked if the text element is not enabled and therefore can't be edited.
       

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Tester:
            Mandy Menzel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 minutes
                5m