Elegant Registration / Log in fix


I have an app which allows users to register using two different email
address suffixes only which identifies them as being from a certain

Let’s call them @abcd.co.uk and @abcdefg.co.uk

The shorter version is just a contraction of the longer version and
are interchangeable for the users in their day to day email activity.
The problem is that some people register with the long form and then
try and log in using the short form.

This causes a headache for the admin who gets unnecessary emails.

What is the most Rails way to deal with this at log in and catch the
users error automatically but still allowing log in? i.e. make the app
insensitive to which email gets used for login / registration etc.

The app uses Resftul_authentication plugin



I don’t use Resftul_authentication, but without knowing the details of
it personally
I’d use a before_filter in ApplicationController (or SignupController
LoginController) to set params[:email] (or whatever) to the shorter
(gsub to replace the long one with the short one).

There may be a better way with Restful_authentication and you’ll need to
find out the param names you need to change the values for, but that may
point you in a direction to get it working…



Andy J.
http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840