[Xfce4-commits] <moka:nick/maintainer-improvements> Send reques to administrators.
Nick Schermer
noreply at xfce.org
Sat Oct 8 20:48:03 CEST 2011
Updating branch refs/heads/nick/maintainer-improvements
to 326af80f83652943b3122efb5fdb316ddf8f93c8 (commit)
from 8b63793a5e58951b41a27b86e1b51abd4c5daeaa (commit)
commit 326af80f83652943b3122efb5fdb316ddf8f93c8
Author: Nick Schermer <nick at xfce.org>
Date: Sat Oct 8 20:39:21 2011 +0200
Send reques to administrators.
lib/controllers/authentication.rb | 20 +++++++++++++++++++-
lib/middleware/mailinglists.rb | 2 +-
.../email/{login_request.erb => login_forget.erb} | 4 ++++
lib/views/email/login_request.erb | 16 +++++-----------
lib/views/login_unauthenticated.haml | 3 +--
5 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/lib/controllers/authentication.rb b/lib/controllers/authentication.rb
index 417088f..884b2b6 100755
--- a/lib/controllers/authentication.rb
+++ b/lib/controllers/authentication.rb
@@ -154,7 +154,7 @@ module Moka
Pony.mail :to => maintainer.email,
:from => Moka::Models::Configuration.get(:noreply),
:subject => "Xfce Release Manager change password request",
- :body => erb(:'email/login_request')
+ :body => erb(:'email/login_forget')
end
env[:step] = "emailed"
@@ -231,6 +231,24 @@ module Moka
@maintainer.active = false
@maintainer.save
+ params[:request_url] = Moka::Models::Configuration.get(:moka_url)
+ params[:request_username] = params[:username]
+ params[:request_stamp] = Time.now.to_s
+
+ subject = "Xfce Release Manager Request: " + params[:username]
+ body = erb(:'email/login_request')
+
+ # mail all admins about the request
+ recipients = Moka::Models::Maintainer.all()
+ for recipient in recipients
+ if recipient.is_admin
+ Pony.mail :to => recipient.email,
+ :from => Moka::Models::Configuration.get(:noreply),
+ :subject => subject,
+ :body => body
+ end
+ end
+
view :login_request_finished
end
end
diff --git a/lib/middleware/mailinglists.rb b/lib/middleware/mailinglists.rb
index fa1b2ba..ce9b36c 100755
--- a/lib/middleware/mailinglists.rb
+++ b/lib/middleware/mailinglists.rb
@@ -65,7 +65,7 @@ module Moka
body = render_body(release, message, sender)
recipients = [ recipients ] unless recipients.is_a? Array
-
+
for recipient in recipients
Pony.mail(:from => sender.display_email,
:to => recipient,
diff --git a/lib/views/email/login_request.erb b/lib/views/email/login_forget.erb
similarity index 73%
copy from lib/views/email/login_request.erb
copy to lib/views/email/login_forget.erb
index ab8372a..b3905db 100644
--- a/lib/views/email/login_request.erb
+++ b/lib/views/email/login_forget.erb
@@ -12,3 +12,7 @@ this request, visit the following link:
If you do nothing, the request will lapse after 2 hours
(<%= params[:token_expire] %>) or when you log in successfully.
+
+The request was generated from <%= request.env['REMOTE_ADDR'] %>. Forward
+this email to the Xfce administrators <xfce-repo-admin at xfce.org> in
+case of problems.
diff --git a/lib/views/email/login_request.erb b/lib/views/email/login_request.erb
index ab8372a..68ec53a 100644
--- a/lib/views/email/login_request.erb
+++ b/lib/views/email/login_request.erb
@@ -1,14 +1,8 @@
-You have (or someone impersonating you has) requested to change your
-Release manager password. To complete the change, visit the following link:
+Hello, this is Moka at <a href="<%= params[:request_url] %>"><%= params[:request_url] %></a>.
-<%= params[:token_url] %>
+The user '<%= params[:request_username] %>' has asked for access from
+<%= request.env['REMOTE_ADDR'] %> on <%= params[:request_stamp] %>.
+Always at your service.
-If you are not the person who made this request, or you wish to cancel
-this request, visit the following link:
-
-<%= params[:token_abort_url] %>
-
-
-If you do nothing, the request will lapse after 2 hours
-(<%= params[:token_expire] %>) or when you log in successfully.
+ --Moka
diff --git a/lib/views/login_unauthenticated.haml b/lib/views/login_unauthenticated.haml
index 196a8b8..36a2ae1 100755
--- a/lib/views/login_unauthenticated.haml
+++ b/lib/views/login_unauthenticated.haml
@@ -1,5 +1,4 @@
%h2 Invalid Username or Password
%p.error The username or password you entered is not valid or the account has not been activated yet.
%p
- Try
- %a{:href => "/login"} again
+ %a{:href => "/login"} Try again
More information about the Xfce4-commits
mailing list