Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notifying an admin of a new registration using Devise

All of my users will be unapproved until they are approved by an admin, the admin will be logging into the site to mark the user as approved. I am following the Devise docs here which is working out great but how do I send an email to the admin once a new user has signed up so that the admin is aware and can approve the sign up?

like image 668
tdelam Avatar asked Feb 02 '12 16:02

tdelam


People also ask

How does devise authentication work?

Devise is an excellent authentication system made for Rails that allows us to easily drop-in User functionality into our project. Devise only includes an email and password for registration, let's also add our own username to our User model. We also want to have a unique index on our username.


1 Answers

How about in your User model, do something like this:

after_create :send_admin_mail
def send_admin_mail
   ###Send email stuff here
end

You may want to use ActionMailer.

There may be some built in Devise way, but I can't find anything. This basically just sends an alert to you.

like image 85
varatis Avatar answered Oct 05 '22 01:10

varatis