Foren

Email verification on login

Shahin Ali, geändert vor 12 Jahren.

Email verification on login

New Member Beiträge: 24 Beitrittsdatum: 03.05.11 Neueste Beiträge
I have imported users from LDAP (users without email address by specifying the property ‘users.email.address.required=false’.

The email address created by liferay(for those who miss email in LDAP) is like '32065@no-emailaddress.com'

But for those users, after login, screen prompts to enter a valid email address is appearing. Can we bypass this?

Using liferay 6.

Thanks
thumbnail
Corné Aussems, geändert vor 12 Jahren.

RE: Email verification on login

Liferay Legend Beiträge: 1313 Beitrittsdatum: 03.10.06 Neueste Beiträge
Shahin Ali:
I have imported users from LDAP (users without email address by specifying the property ‘users.email.address.required=false’.

The email address created by liferay(for those who miss email in LDAP) is like '32065@no-emailaddress.com'

But for those users, after login, screen prompts to enter a valid email address is appearing. Can we bypass this?

Using liferay 6.

Thanks

I suppose you mean when updating a user one must give a true email address

Unfortunately this seems really low level code
UserLocalServiceImpl.updateUser


		EmailAddressGenerator emailAddressGenerator =
			EmailAddressGeneratorFactory.getInstance();

		if (emailAddressGenerator.isGenerated(emailAddress)) {
			emailAddress = StringPool.BLANK;
		}

		if (!PropsValues.USERS_EMAIL_ADDRESS_REQUIRED &&
			Validator.isNull(emailAddress)) {

			emailAddress = emailAddressGenerator.generate(
				user.getCompanyId(), userId);
		}

thumbnail
Nikhil Kumar Gupta, geändert vor 12 Jahren.

RE: Email verification on login

Junior Member Beiträge: 51 Beitrittsdatum: 30.06.09 Neueste Beiträge
Are you getting this error after successful login or before that.
If you are not even able to login, override following property in portal.properties

company.security.auth.type=emailAddress -> screenname or userid
If you are getting this after login, let me know the page you are landing at.

Nikhil
Shahin Ali, geändert vor 12 Jahren.

RE: Email verification on login

New Member Beiträge: 24 Beitrittsdatum: 03.05.11 Neueste Beiträge
Hi Nikhil,

I am getting this page after successful login. Please see the attached screenshot.

Thanks lot.
Diwakar Arunachalam, geändert vor 12 Jahren.

RE: Email verification on login

New Member Beitrag: 1 Beitrittsdatum: 21.01.11 Neueste Beiträge
Hi Nikhil/Shahin,

Am also facing same problem. If it is already solved please let me know to disable email update screen.

Thanks.

Regards,
Diwakar.
Shahin Ali, geändert vor 12 Jahren.

RE: Email verification on login

New Member Beiträge: 24 Beitrittsdatum: 03.05.11 Neueste Beiträge
No Way out yet emoticon
thumbnail
Suraj Bihari, geändert vor 12 Jahren.

RE: Email verification on login

Junior Member Beiträge: 41 Beitrittsdatum: 20.05.11 Neueste Beiträge
Hey All,

I found a solution:

portal-ext.properties:

  # Set this to false if you want to be able to create users without an email
    # address. An email address will be automatically assigned to a user based
    # on the property "users.email.address.auto.suffix".
    #
    users.email.address.required=false
    company.security.auth.type=screenName

    #
    # Set the suffix of the email address that will be automatically generated
    # for a user that does not have an email address. This property is not used
    # unless the property "users.email.address.required" is set to false. The
    # autogenerated email address will be the user id plus the specified suffix.
    #
    users.email.address.auto.suffix=noreply@email.com
    
    login.events.pre=com.company.LdapEmailHook


This will generate an email concatenating uid + suffix .. almost there...

Next create a pre-login hook


// get the remote user
HttpSession session = request.getSession();

        String userId = request.getRemoteUser();

        // get the user object
        try {
            User user = UserLocalServiceUtil.getUserById( Long.parseLong( userId ) );
            
            // change email
            user.setEmailAddress("no-reply@email.com");
            
            // update the user
            user = UserLocalServiceUtil.updateUser(user);

        }
        catch (Exception e)
        {
           System.out.println( "Exception: " + e.getMessage() );
        }       
         


Voila!
Cheers!

Suraj