We've moved discussions to Discord

How do I create a new (non admin) user when logged in as an admin without requiring a password for the new account

Use Case: As a site admin, I want to login to the admin panel and create a new user without entering a password for that account.

I have looked at controllers/admin/users_controller.rb, but I cannot seem to work out how to enable an admin user to create a standard user account from the default 'users' list.

I am using this as a backoffice application so staff members will manually create user accounts to start with. Ideally I want to either auto-generate a random password for the new user account, or leave the password blank and send them an invitation to finish setting up their account (via Devise).

Any pointers appreciated.
Andrew Hodson
I just create the record using
@user = User.create(:name => @name, :email => @email, :password => 'RANDOM', :password_confirmation => 'RANDOM', :terms_of_service => '1')
Then you can send an email with the RANDOM password. 
Thanks Andrew, i'll give this a go. So to confirm, you would have this inside `controllers/admin/users_controller.rb` within `def create` ?
Andrew Hodson
Well, I use it to load new users as well as loading a "quick quote". So I have a form that submits to the quote controller and checks to see if the user is signed in or create one.
Notifications
You’re not receiving notifications from this thread.