I think of two approaches for solving this:

1) letting user type their full email address

2) letting user type the prefix of their email address. Ex. bob for
[email protected]. User could select from a list of mail hosts like (gmail,
hotmail, ...)

3) add a domain field to the form

-------------------------------------------------------------------------------------

1) extend the regular expression in the user model (~line 33) so that it
fits the domains you allow
    validates_format_of :email, :with =>
/^([...@\s]{1}+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create,
:message=>"Invalid
email address or domain."

2) add a select field to your form which get values from (let's say) a
constant in your User model where you store the allowed domain like
ALLOWED_DOMAIN=[...]. You still can keep the validation for the whole email
address (before validation concatenate the two fields).

3) let people type in their username and the domain into the next field (ex.
e_domain)
than you can add a validation to that field like
validates_inclussion_of :e_domain, :in => [gmail.com, hotmail.com,....]

That's not the complete code but a point from which you can start.


Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Lovd by Less" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lovdbyless?hl=en
Who loves ya baby?
-~----------~----~----~----~------~----~------~--~---

Reply via email to