开发者

Creating users using e-mail address only - ruby on rails

开发者 https://www.devze.com 2023-03-21 01:19 出处:网络
I want to be able to create a user using only their e-mail address. i.e. I want the admin to be able to enter a bunch of e-mail addresses, which will automatically create a new user and password and

I want to be able to create a user using only their e-mail address.

i.e. I want the admin to be able to enter a bunch of e-mail addresses, which will automatically create a new user and password and then e-mail the information to the address provided.

So I am hoping to figure out how to:

Create users using only e-mail addresses (rest can be randomly generated) E-mail users their passwords and login details.

Any suggestions on a best way to approach this? I'm using authlog开发者_如何学Goic for authentication.

Cheers!


I'd recommend using devise for this, as it handles generating confirmation emails, as well as the routes for confirming an email. A relevant tutorial for allowing users to sign up with just their email addresses: http://blog.devinterface.com/2011/05/two-step-signup-with-devise/

For having an admin create users, it'll be much the same, just generate random passwords+confirmations, and then call user.send_reset_password_instructions to send the email (which can be customized as in Ruby/Rails: How do you customize the mailer templates of Devise? )

see also: Rails Devise: Set password reset token and redirect user

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号