Hi all, I have a basic noobie question, but I can''t find my answer. I''ve installed the acts as authenticated plug-in, and its incredibly easy to use. My only issue is that it doesn''t give explicit exceptions for different conditions of a login failure. For instance, if a login id doesn''t exist, I''d like to raise the "NoSuchUser" exception, if they haven''t confirmed registration, I''d like to raise the "UserNotActivated" exception. These error are raised in the user model, and I''d like to catch them in the controller and flash the appropriate message. Where in the rails framework layout would I define the exception classes? I''d like to keep a class file per ruby file for cleaner code, and it doesn''t seem that they belong in the "app" directory. Thanks Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Todd I think you cn find your answer by looking at this modified version of AAA login method def login return unless request.post? self.current_user = User.authenticate(params[:login], params[:password]) if logged_in? if params[:remember_me] == "1" self.current_user.remember_me cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } end # redirect_back_or_default(:controller => ''/account'', :action => ''index'') # redirect_back_or_default(:controller => ''main'' , :action => ''index'') redirect_back_or_default(:controller => ''messages_inbox'' , :action => ''list'') flash[:notice] = "Logged in successfully" else flash[:notice] = "Invalid Login/Password !" end end On Oct 7, 12:11 pm, Todd Nine <todd.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > I have a basic noobie question, but I can''t find my answer. I''ve > installed the acts as authenticated plug-in, and its incredibly easy > to use. My only issue is that it doesn''t give explicit exceptions for > different conditions of a login failure. For instance, if a login id > doesn''t exist, I''d like to raise the "NoSuchUser" exception, if they > haven''t confirmed registration, I''d like to raise the > "UserNotActivated" exception. These error are raised in the user > model, and I''d like to catch them in the controller and flash the > appropriate message. Where in the rails framework layout would I > define the exception classes? I''d like to keep a class file per ruby > file for cleaner code, and it doesn''t seem that they belong in the > "app" directory. > > Thanks > Todd--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Todd I think you cn find your answer by looking at this modified version of AAA login method def login return unless request.post? self.current_user = User.authenticate(params[:login], params[:password]) if logged_in? if params[:remember_me] == "1" self.current_user.remember_me cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } end # redirect_back_or_default(:controller => ''/ account'', :action => ''index'') # redirect_back_or_default(:controller => ''main'' , :action => ''index'') redirect_back_or_default(:controller => ''messages_inbox'' , :action => ''list'') flash[:notice] = "Logged in successfully" else flash[:notice] = "Invalid Login/Password !" end end CCH http://cch4rails.blogspot.com On Oct 7, 12:11 pm, Todd Nine <todd.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > I have a basic noobie question, but I can''t find my answer. I''ve > installed the acts as authenticated plug-in, and its incredibly easy > to use. My only issue is that it doesn''t give explicit exceptions for > different conditions of a login failure. For instance, if a login id > doesn''t exist, I''d like to raise the "NoSuchUser" exception, if they > haven''t confirmed registration, I''d like to raise the > "UserNotActivated" exception. These error are raised in the user > model, and I''d like to catch them in the controller and flash the > appropriate message. Where in the rails framework layout would I > define the exception classes? I''d like to keep a class file per ruby > file for cleaner code, and it doesn''t seem that they belong in the > "app" directory. > > Thanks > Todd--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---