I am using devise gem in a rails application with multiple subdomains. Each subdomain is handled by respective controller, which look like this:
class Subdomain1Controller < ApplicationController
before_filter :authenticate_user!
def index
end
end
With above controller implementation, Devise always keep subdomain while redirecting user to login page. In above case, Devise redirect user to http://subdomain1.acmesite/users/sign_in instead of a common sign_in Url.
This leads to having multiple sign_in urls for each sub-domains.
http://subdomain1.acmesite/users/sign_in
http://subdomain2.acmesite/users/sign_in
http://subdomain3.acmesite/users/sign_in
I am wondering if it’s possible to override devise method to exclude subdomain part from the url and yet keeping the previous page url information. More preciously, I wants Devise to redirect user to a specific Url (like: http://acmesite/users/sign_in) irrespective of subdomain and after successful authentication, Devise should return user back to the caller subdomain+page.
I droped Devise gem from my project and now using Sorcery instead.
Sorcery provide me complete control over controller and view, fully comply with my project requirements. With six months running on production after this transition, I am happy with Sorcery gem.