Delay and or resend Devise's confirmation email for manually created users

后端 未结 7 1959
予麋鹿
予麋鹿 2021-01-30 22:37

I\'m using Devise to allow user signup as-well-as using my own user admin to create users manually. When I create a user in the admin, Devise sends a confirmati

7条回答
  •  走了就别回头了
    2021-01-30 22:59

    There's now an easier way (was added back in v2.2.4)

    Devise's confirmable module now includes the perfect skip_confirmation_notification! method which allows for a cleaner solution:

    @user = User.new params[:user]
    @user.skip_confirmation_notification! 
    @user.save
    
    # ... do stuff, then later...
    
    Devise::Mailer.confirmation_instructions(@user).deliver 
    

提交回复
热议问题