Skip to content

Commit

Permalink
Add a new function: administrators are notified by email for each new…
Browse files Browse the repository at this point in the history
… user
  • Loading branch information
s2j1h committed Oct 17, 2010
1 parent 7ef2f18 commit af52604
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Registration successful."
Notifier.deliver_new_user(@user)
redirect_to :controller => "identities", :action => "index"
else
render :action => 'new'
Expand Down
11 changes: 8 additions & 3 deletions app/models/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Notifier < ActionMailer::Base
default_url_options[:host] = "vauban.heroku.com"

def password_reset_instructions(user)
subject "Password Reset Instructions"
subject "Password Reset Instructions for Vauban"
from "vauban@zeneffy.fr"
recipients user.email
content_type "text/html"
Expand All @@ -18,6 +18,11 @@ def feedback(feedback)
@body[:feedback] = feedback
end



def new_user(user)
@recipients = 'vauban@zeneffy.fr'
@from = 'vauban@zeneffy.fr'
@subject = "[Vauban.zeneffy.fr] New user!"
@sent_on = Time.now
@body[:user] = user
end
end
7 changes: 7 additions & 0 deletions app/views/notifier/new_user.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dear site administrator,

You're lucky today, you've got a new user!

User: <%=h @user.username %>
User's email: <%=h @user.email %>
Registered at: <%= Time.now %>
Binary file modified db/development.sqlite3
Binary file not shown.

0 comments on commit af52604

Please sign in to comment.