[Xfce4-commits] <moka:master> Improve acount request.
Nick Schermer
noreply at xfce.org
Thu Nov 24 19:32:01 CET 2011
Updating branch refs/heads/master
to 7ade0ef23c2947f10eb728210f76ea34eda8e71f (commit)
from e5fe38f794523a62f5b1f7e5ee5e3b53aeae0e3e (commit)
commit 7ade0ef23c2947f10eb728210f76ea34eda8e71f
Author: Nick Schermer <nick at xfce.org>
Date: Thu Nov 24 19:30:29 2011 +0100
Improve acount request.
lib/controllers/authentication.rb | 31 +++++++++++++++++++++----------
lib/views/email/login_request.erb | 5 +++++
lib/views/login_request.haml | 7 +++++++
3 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/lib/controllers/authentication.rb b/lib/controllers/authentication.rb
index 8d6ae72..cdac05d 100755
--- a/lib/controllers/authentication.rb
+++ b/lib/controllers/authentication.rb
@@ -241,25 +241,36 @@ module Moka
error_set(:message, 'This username is already taken')
view :login_request
else
+ pubkeys_arr = []
+ params[:pubkeys].split("\n").each do |key|
+ key = key.strip
+ pubkeys_arr.push(key) if not key.empty? and key.start_with? "ssh-"
+ end
+
@maintainer = Moka::Models::Maintainer.create(:username => params[:username])
@maintainer.email = params[:email]
@maintainer.realname = params[:realname]
@maintainer.password = Digest::SHA1.hexdigest(params[:password])
+ @maintainer.pubkeys = pubkeys_arr.join("\n") unless pubkeys_arr.empty?
@maintainer.active = false
@maintainer.save
- subject = "Xfce Release Manager Request: " + params[:username]
- body = erb(:'email/login_request')
+ # collect admin emails
+ recipients = []
+ for recipient in Moka::Models::Maintainer.all()
+ recipients.push(recipient.email) if recipient.is_admin
+ end
# 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
+ if not recipients.empty?
+ subject = "Xfce Release Manager Request: " + params[:username]
+ body = erb(:'email/login_request')
+
+ Pony.mail :to => recipients.join(', '),
+ :from => Moka::Models::Configuration.get(:noreply),
+ :subject => subject,
+ :reply_to => params[:email],
+ :body => body
end
view :login_request_finished
diff --git a/lib/views/email/login_request.erb b/lib/views/email/login_request.erb
index 0dc94d1..37dfae3 100644
--- a/lib/views/email/login_request.erb
+++ b/lib/views/email/login_request.erb
@@ -2,6 +2,11 @@ Hello, this is Moka at <%= Moka::Models::Configuration.get(:moka_url) %>.
The user '<%= params[:username] %>' has asked for access from <%= request.env['REMOTE_ADDR'] %> on <%= Time.now.to_s %>.
+=======
+<%= params[:msg] %>
+
+=======
+
Always at your service.
--Moka
diff --git a/lib/views/login_request.haml b/lib/views/login_request.haml
index 32b400b..93f7e1f 100644
--- a/lib/views/login_request.haml
+++ b/lib/views/login_request.haml
@@ -40,6 +40,13 @@
%p
%label{:for => "pubkeys"} SSH public-keys:
%textarea{:name => "pubkeys", :rows => "5", :id => "pubkeys", :wrap => "off"} #{params[:pubkeys]}
+ %hr
+ %p.quote
+ Some additional information to help us remind you. Which project do you want to work on
+ or start a new project you've already discussed on the xfce4-dev mailing list.
+ %p
+ %label{:for => "msg"} Additional Info:
+ %textarea{:name => "msg", :rows => "5", :id => "msg"} #{params[:msg]}
%p
%input{:type => "submit", :value => "Submit"}
More information about the Xfce4-commits
mailing list