How To: Allow users to sign in using their username or email address
Flexible authentication solution for Rails with Warden. - heartcombo/devise