留言板
Email verification on login
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
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
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);
}
Nikhil Kumar Gupta,修改在12 年前。
RE: Email verification on login
Junior Member 帖子: 51 加入日期: 09-6-30 最近的帖子
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
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
Hey All,
I found a solution:
portal-ext.properties:
This will generate an email concatenating uid + suffix .. almost there...
Next create a pre-login hook
Voila!
Cheers!
Suraj
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