S
S
Sahnen2017-03-06 15:21:06
Ruby on Rails
Sahnen, 2017-03-06 15:21:06

Devise: How to disable autologin after registration?

Compared to out-of-the-box functionality, registration has changed a bit. The bottom line is this: for registration, only the email is entered, to which the generated password is sent. Everything is fine, except that after sending mail with a password, login occurs automatically, which must be removed.
The code responsible for registration is standard. Where to dig?

yield resource if block_given?
    if resource.persisted?
      if resource.active_for_authentication?
        set_flash_message! :notice, :signed_up
        sign_up(resource_name, resource)
        respond_with resource, location: after_sign_up_path_for(resource)
      else
        set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
        expire_data_after_sign_in!
        respond_with resource, location: after_inactive_sign_up_path_for(resource)
      end
    else
      clean_up_passwords resource
      set_minimum_password_length
      respond_with resource
    end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
N. Bekseitov, 2017-03-06
@Sahnen

Just comment out sign_up. This method just calls sign_in
https://github.com/plataformatec/devise/blob/maste...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question