[Xfce4-commits] <moka:master> Send mail to user when account is activated.

Nick Schermer noreply at xfce.org
Sun Nov 20 14:30:36 CET 2011


Updating branch refs/heads/master
         to 0965690742b27b0725b6550ddb0ee6efc5962b8d (commit)
       from 58b8564a64c6805b6ff0d9f090055da09706ba56 (commit)

commit 0965690742b27b0725b6550ddb0ee6efc5962b8d
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Oct 10 20:32:59 2011 +0200

    Send mail to user when account is activated.

 lib/controllers/maintainers.rb           |   13 ++++++++++---
 lib/views/email/maintainer_activated.erb |   11 +++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/controllers/maintainers.rb b/lib/controllers/maintainers.rb
index 760ada6..a8e01bf 100755
--- a/lib/controllers/maintainers.rb
+++ b/lib/controllers/maintainers.rb
@@ -77,16 +77,23 @@ module Moka
           view :maintainer_profile
         end
 
-        app.post '/maintainer/:name/activate' do
+        app.post '/maintainer/:username/activate' do
           authentication_required
 
-          maintainer = Maintainer.get(params[:name])
+          maintainer = Maintainer.get(params[:username])
           if maintainer
             maintainer.active = !maintainer.active
             maintainer.save
+
+            if maintainer.active
+              Pony.mail :to => @maintainer.email,
+                        :from => Moka::Models::Configuration.get(:noreply),
+                        :subject => 'Release Manager Account Activated',
+                        :body => erb(:'email/maintainer_activated')
+            end
           end
 
-          redirect "/maintainer/#{params[:name]}"
+          redirect "/maintainer/#{params[:username]}"
         end
 
         app.post '/maintainer/:name/delete' do
diff --git a/lib/views/email/maintainer_activated.erb b/lib/views/email/maintainer_activated.erb
new file mode 100644
index 0000000..3a11a42
--- /dev/null
+++ b/lib/views/email/maintainer_activated.erb
@@ -0,0 +1,11 @@
+Hello <%= params[:username] %>, this is Moka at <%= Moka::Models::Configuration.get(:moka_url) %>.
+
+Your account has been activated. You can view your permissions in the profile tab in the release manager.
+
+Please keep in mind that updating the SSH public-keys on the server can take up to 1 hour.
+
+If you have any questions, don't hesitate to contact us at <releases at xfce.org>.
+
+Always at your service.
+
+ --Moka


More information about the Xfce4-commits mailing list