简体   繁体   中英

Rails: Devise: How to not auto sign in user after registration

I am trying to have model leader sign up a bunch of model users .

However, after the leader signs up a user, by default Devise will sign in the new user. This prevents the leader from creating more new users because devise recognizes the user is already signed in.

So my question is, do you know how to modify the registration/sign up process in devise so that new users are not automatically signed in ?

If you are creating them in an admin portal or as a leader that is signed in just create a users controller with a create action that creates a new user, sets a random password them and then persist to database. This can vary dramatically based on how you are doing your tenancy, but here is the general gist of it.

class UsersController < ApplicationController

  def create
    #find leader
    #build a user under the leader with a password
    #persist the new user
    #return json/html based on creation
  end

end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM