| Oliver Chen wrote
2. I want to disallow some public email addresses to register in dotnetnuke. Can it be done? For example, when the user registers with yahoo or hotmail email accounts, an error message will be displayed and inform him the email entered is not valid for registration.
|
Oliver,
Regarding your second question, how about the following?:
1. Fix the Regular Expression used to validate new users email addresses:
This parameter is within the User Settings page, under Admin - User Accounts and on the lower right click the link.
The parameter is called Email Address Validation and is the fourth before the end of the list. It contains the following regex:
\b[a-zA-Z0-9._%\-+']+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4}\b
If what you wish is to filter domains like 'yahoo', 'hotmail' or 'gmail' after the @ char, then you must add the following subexpression right there:
(?i)(?!yahoo|hotmail|gmail)
...the final regex will look like this:
\b[a-zA-Z0-9._%\-+']+@(?i)(?!yahoo|hotmail|gmail)[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4}\b
(click on 'Update' ;-)
2. Modify the messages related to the email address handling during registration:
It is important that you inform your user what type of email addresses you will allow, and if he enters a wrong address, you should explain to him that he tried to use one of those email addresses that are not allowed. If your default language is en-US, those messages are inside:
- Directory: admin\Users\App_LocalResources
- File: User.ascx.resx
Within this file look for the following text resources and modify their values, appending what is in italic and bold.
- Resource Name: 'Value and appended value'
- UserInfo_Email.Text: 'Email Address: <br>(Do not use a public email address)'
- UserInfo_Email.Help: 'Enter a valid Email address. Please do not use a public email address, like Yahoo, Hotmail or Gmail.'
- UserInfo_Email.Validation: 'You must enter a valid email address. <br>No Yahoos, Hotmails nor Gmails, ¿ok?'
That's it. Give it a try!
Saludos,
Alejandro.