Be Sure to Help Out When a User Forgets The URL to Their Subdomain Login Screen

Posted by Scott Thu, 08 Mar 2007 04:10:00 GMT

It has become common practice for Web 2.0 applications to provide each account with their own subdomain. This approach lets account owners feel that they have their own space, can be part of branding a product at least partly with their name, and helps with authorization scope.

We use subdomain accounts with LeadsOnRails.com, the small business lead management software. We have found that, believe it or not, users often forget their subdomain or forget to enter it. Typical applications might at worse ignore this problem and miss out on some active users, or at best might provide a reminder that the proper login is [somewhere].bestappever.com. But what if the user forgets where their [somewhere] is?

For those occasions, provide your users with a way to be sent to their login screen via entering some unique identifier such as email.

Here’s what worked for me. Create a find form that simply prompts the user for their email address. Call a method to find the account by email and then either redirect to that account’s login URL or reply with a “email not found” message.

Code snippets:

views/sessions/find.rhtml
...
<%= start_form_tag :action => "find_login" %>
...
   <%= text_field_tag :email, params[:email] %>
...
<%= submit_tag 'Take me to my login screen' %>
...
</form>

controllers/sessions_controller.rb
def find_login
  @user = User.find_by_email(params[:email])
  @website = @user.account.website unless @user.nil?
  if @website 
    redirect_to("http://#{@website}.leadsonrails.com/login")
  else
    flash[:error] = "Sorry, we could not find a user 
      with that email address. Please contact us for support." 
    redirect_to :action => "find" 
  end
end

Comments

(leave url/email »)