Autologue in authlogic Rails

I added auhlogic to my Rails application to authenticate users. I also included code from the Reset password tutorial . It all works, the only problem I am facing is that after user registration, it is automatically registered.

Has anyone worked with authlogic, what would be the best and fastest way to disable autologin after registration?

+4
source share
3 answers

After saving save successfully

session = UserSession.find session.destroy if session 
+2
source

You can use #save_without_session_maintenance:

 @user = User.new(params[:user]) @user.save_without_session_maintenance 
+15
source

If you will use this method:

After saving save successfully

  session = UserSession.find session.destroy if session 

You are likely to lose your administrator session, which may add a user.
Thus, the best way would be to simply add some parameters to your user.rb model:

 acts_as_authentic do |c| c.maintain_sessions = false #for more options check the AuthLogic documentation end 

Now it should work.

+6
source

Source: https://habr.com/ru/post/1305831/


All Articles