##// END OF EJS Templates
r17044@gaspard (orig r915): jplang | 2007-11-18 18:46:55 +0100...
Nicolas Chuche -
r1780:1bb237c3e004
parent child
Show More
@@ -0,0 +1,2
1 <p><%= l(:mail_body_account_activation_request, @user.login) %></p>
2 <p><%= link_to @url, @url %></p>
@@ -0,0 +1,2
1 <%= l(:mail_body_account_activation_request, @user.login) %>
2 <%= @url %>
@@ -21,7 +21,7 class AccountController < ApplicationController
21 include CustomFieldsHelper
21 include CustomFieldsHelper
22
22
23 # prevents login action to be filtered by check_if_login_required application scope filter
23 # prevents login action to be filtered by check_if_login_required application scope filter
24 skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
24 skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register, :activate]
25
25
26 # Show user's account
26 # Show user's account
27 def show
27 def show
@@ -106,40 +106,62 class AccountController < ApplicationController
106 # User self-registration
106 # User self-registration
107 def register
107 def register
108 redirect_to(home_url) && return unless Setting.self_registration?
108 redirect_to(home_url) && return unless Setting.self_registration?
109 if params[:token]
109 if request.get?
110 token = Token.find_by_action_and_value("register", params[:token])
110 @user = User.new(:language => Setting.default_language)
111 redirect_to(home_url) && return unless token and !token.expired?
111 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
112 user = token.user
113 redirect_to(home_url) && return unless user.status == User::STATUS_REGISTERED
114 user.status = User::STATUS_ACTIVE
115 if user.save
116 token.destroy
117 flash[:notice] = l(:notice_account_activated)
118 redirect_to :action => 'login'
119 return
120 end
121 else
112 else
122 if request.get?
113 @user = User.new(params[:user])
123 @user = User.new(:language => Setting.default_language)
114 @user.admin = false
124 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
115 @user.login = params[:user][:login]
125 else
116 @user.status = User::STATUS_REGISTERED
126 @user = User.new(params[:user])
117 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
127 @user.admin = false
118 if params["custom_fields"]
128 @user.login = params[:user][:login]
129 @user.status = User::STATUS_REGISTERED
130 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
131 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
119 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
132 @user.custom_values = @custom_values
120 @user.custom_values = @custom_values
121 end
122 case Setting.self_registration
123 when '1'
124 # Email activation
133 token = Token.new(:user => @user, :action => "register")
125 token = Token.new(:user => @user, :action => "register")
134 if @user.save and token.save
126 if @user.save and token.save
135 Mailer.deliver_register(token)
127 Mailer.deliver_register(token)
136 flash[:notice] = l(:notice_account_register_done)
128 flash[:notice] = l(:notice_account_register_done)
137 redirect_to :controller => 'account', :action => 'login'
129 redirect_to :action => 'login'
130 end
131 when '3'
132 # Automatic activation
133 @user.status = User::STATUS_ACTIVE
134 if @user.save
135 flash[:notice] = l(:notice_account_activated)
136 redirect_to :action => 'login'
137 end
138 else
139 # Manual activation by the administrator
140 if @user.save
141 # Sends an email to the administrators
142 Mailer.deliver_account_activation_request(@user)
143 flash[:notice] = l(:notice_account_pending)
144 redirect_to :action => 'login'
138 end
145 end
139 end
146 end
140 end
147 end
141 end
148 end
142
149
150 # Token based account activation
151 def activate
152 redirect_to(home_url) && return unless Setting.self_registration? && params[:token]
153 token = Token.find_by_action_and_value('register', params[:token])
154 redirect_to(home_url) && return unless token and !token.expired?
155 user = token.user
156 redirect_to(home_url) && return unless user.status == User::STATUS_REGISTERED
157 user.status = User::STATUS_ACTIVE
158 if user.save
159 token.destroy
160 flash[:notice] = l(:notice_account_activated)
161 end
162 redirect_to :action => 'login'
163 end
164
143 private
165 private
144 def logged_user=(user)
166 def logged_user=(user)
145 if user && user.is_a?(User)
167 if user && user.is_a?(User)
@@ -88,6 +88,14 class Mailer < ActionMailer::Base
88 :password => password,
88 :password => password,
89 :login_url => url_for(:controller => 'account', :action => 'login')
89 :login_url => url_for(:controller => 'account', :action => 'login')
90 end
90 end
91
92 def account_activation_request(user)
93 # Send the email to all active administrators
94 recipients User.find_active(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact
95 subject l(:mail_subject_account_activation_request)
96 body :user => user,
97 :url => url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc')
98 end
91
99
92 def lost_password(token)
100 def lost_password(token)
93 set_language_if_valid(token.user.language)
101 set_language_if_valid(token.user.language)
@@ -102,7 +110,7 class Mailer < ActionMailer::Base
102 recipients token.user.mail
110 recipients token.user.mail
103 subject l(:mail_subject_register)
111 subject l(:mail_subject_register)
104 body :token => token,
112 body :token => token,
105 :url => url_for(:controller => 'account', :action => 'register', :token => token.value)
113 :url => url_for(:controller => 'account', :action => 'activate', :token => token.value)
106 end
114 end
107
115
108 def test(user)
116 def test(user)
@@ -29,9 +29,6
29 <% for @custom_value in @custom_values %>
29 <% for @custom_value in @custom_values %>
30 <p><%= custom_field_tag_with_label @custom_value %></p>
30 <p><%= custom_field_tag_with_label @custom_value %></p>
31 <% end %>
31 <% end %>
32
33 <p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
34 <%= check_box 'user', 'mail_notification' %></p>
35 <!--[eoform:user]-->
32 <!--[eoform:user]-->
36 </div>
33 </div>
37
34
@@ -78,7 +78,12
78 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p>
78 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p>
79
79
80 <p><label><%= l(:setting_self_registration) %></label>
80 <p><label><%= l(:setting_self_registration) %></label>
81 <%= check_box_tag 'settings[self_registration]', 1, Setting.self_registration? %><%= hidden_field_tag 'settings[self_registration]', 0 %></p>
81 <%= select_tag 'settings[self_registration]',
82 options_for_select( [[l(:label_disabled), "0"],
83 [l(:label_registration_activation_by_email), "1"],
84 [l(:label_registration_manual_activation), "2"],
85 [l(:label_registration_automatic_activation), "3"]
86 ], Setting.self_registration ) %></p>
82
87
83 <p><label><%= l(:label_password_lost) %></label>
88 <p><label><%= l(:label_password_lost) %></label>
84 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
89 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
@@ -28,7 +28,7 welcome_text:
28 login_required:
28 login_required:
29 default: 0
29 default: 0
30 self_registration:
30 self_registration:
31 default: 1
31 default: '2'
32 lost_password:
32 lost_password:
33 default: 1
33 default: 1
34 attachment_max_size:
34 attachment_max_size:
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -75,6 +75,7 notice_email_error: An error occurred while sending mail (%s)
75 notice_feeds_access_key_reseted: Your RSS access key was reseted.
75 notice_feeds_access_key_reseted: Your RSS access key was reseted.
76 notice_failed_to_save_issues: "Failed to save %d issue(s) on %d selected: %s."
76 notice_failed_to_save_issues: "Failed to save %d issue(s) on %d selected: %s."
77 notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
77 notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
78 notice_account_pending: "Your account was created and is now pending administrator approval."
78
79
79 mail_subject_lost_password: Your Redmine password
80 mail_subject_lost_password: Your Redmine password
80 mail_body_lost_password: 'To change your Redmine password, click on the following link:'
81 mail_body_lost_password: 'To change your Redmine password, click on the following link:'
@@ -82,6 +83,8 mail_subject_register: Redmine account activation
82 mail_body_register: 'To activate your Redmine account, click on the following link:'
83 mail_body_register: 'To activate your Redmine account, click on the following link:'
83 mail_body_account_information_external: You can use your "%s" account to log into Redmine.
84 mail_body_account_information_external: You can use your "%s" account to log into Redmine.
84 mail_body_account_information: Your Redmine account information
85 mail_body_account_information: Your Redmine account information
86 mail_subject_account_activation_request: Redmine account activation request
87 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
85
88
86 gui_validation_error: 1 error
89 gui_validation_error: 1 error
87 gui_validation_error_plural: %d errors
90 gui_validation_error_plural: %d errors
@@ -171,8 +174,8 setting_app_title: Application title
171 setting_app_subtitle: Application subtitle
174 setting_app_subtitle: Application subtitle
172 setting_welcome_text: Welcome text
175 setting_welcome_text: Welcome text
173 setting_default_language: Default language
176 setting_default_language: Default language
174 setting_login_required: Authent. required
177 setting_login_required: Authentication required
175 setting_self_registration: Self-registration enabled
178 setting_self_registration: Self-registration
176 setting_attachment_max_size: Attachment max. size
179 setting_attachment_max_size: Attachment max. size
177 setting_issues_export_limit: Issues export limit
180 setting_issues_export_limit: Issues export limit
178 setting_mail_from: Emission email address
181 setting_mail_from: Emission email address
@@ -446,6 +449,9 label_user_mail_option_all: "For any event on all my projects"
446 label_user_mail_option_selected: "For any event on the selected projects only..."
449 label_user_mail_option_selected: "For any event on the selected projects only..."
447 label_user_mail_option_none: "Only for things I watch or I'm involved in"
450 label_user_mail_option_none: "Only for things I watch or I'm involved in"
448 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
451 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
452 label_registration_activation_by_email: account activation by email
453 label_registration_manual_activation: manual account activation
454 label_registration_automatic_activation: automatic account activation
449
455
450 button_login: Login
456 button_login: Login
451 button_submit: Submit
457 button_submit: Submit
@@ -541,3 +541,9 mail_body_account_information: Your Redmine account information
541 setting_protocol: Protocol
541 setting_protocol: Protocol
542 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
542 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
543 setting_time_format: Time format
543 setting_time_format: Time format
544 label_registration_activation_by_email: account activation by email
545 mail_subject_account_activation_request: Redmine account activation request
546 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
547 label_registration_automatic_activation: automatic account activation
548 label_registration_manual_activation: manual account activation
549 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -75,6 +75,7 notice_email_error: "Erreur lors de l'envoi de l'email (%s)"
75 notice_feeds_access_key_reseted: Votre clé d'accès aux flux RSS a été réinitialisée.
75 notice_feeds_access_key_reseted: Votre clé d'accès aux flux RSS a été réinitialisée.
76 notice_failed_to_save_issues: "%d demande(s) sur les %d sΓ©lectionnΓ©es n'ont pas pu Γͺtre mise(s) Γ  jour: %s."
76 notice_failed_to_save_issues: "%d demande(s) sur les %d sΓ©lectionnΓ©es n'ont pas pu Γͺtre mise(s) Γ  jour: %s."
77 notice_no_issue_selected: "Aucune demande sΓ©lectionnΓ©e ! Cochez les demandes que vous voulez mettre Γ  jour."
77 notice_no_issue_selected: "Aucune demande sΓ©lectionnΓ©e ! Cochez les demandes que vous voulez mettre Γ  jour."
78 notice_account_pending: "Votre compte a été créé et attend l'approbation de l'administrateur."
78
79
79 mail_subject_lost_password: Votre mot de passe redMine
80 mail_subject_lost_password: Votre mot de passe redMine
80 mail_body_lost_password: 'Pour changer votre mot de passe Redmine, cliquez sur le lien suivant:'
81 mail_body_lost_password: 'Pour changer votre mot de passe Redmine, cliquez sur le lien suivant:'
@@ -82,6 +83,8 mail_subject_register: Activation de votre compte redMine
82 mail_body_register: 'Pour activer votre compte Redmine, cliquez sur le lien suivant:'
83 mail_body_register: 'Pour activer votre compte Redmine, cliquez sur le lien suivant:'
83 mail_body_account_information_external: Vous pouvez utiliser votre compte "%s" pour vous connecter Γ  Redmine.
84 mail_body_account_information_external: Vous pouvez utiliser votre compte "%s" pour vous connecter Γ  Redmine.
84 mail_body_account_information: Paramètres de connexion de votre compte Redmine
85 mail_body_account_information: Paramètres de connexion de votre compte Redmine
86 mail_subject_account_activation_request: "Demande d'activation d'un compte Redmine"
87 mail_body_account_activation_request: "Un nouvel utilisateur (%s) s'est inscrit. Son compte nΓ©cessite votre approbation:"
85
88
86 gui_validation_error: 1 erreur
89 gui_validation_error: 1 erreur
87 gui_validation_error_plural: %d erreurs
90 gui_validation_error_plural: %d erreurs
@@ -171,8 +174,8 setting_app_title: Titre de l'application
171 setting_app_subtitle: Sous-titre de l'application
174 setting_app_subtitle: Sous-titre de l'application
172 setting_welcome_text: Texte d'accueil
175 setting_welcome_text: Texte d'accueil
173 setting_default_language: Langue par dΓ©faut
176 setting_default_language: Langue par dΓ©faut
174 setting_login_required: Authentif. obligatoire
177 setting_login_required: Authentification obligatoire
175 setting_self_registration: Enregistrement autorisΓ©
178 setting_self_registration: Inscription des nouveaux utilisateurs
176 setting_attachment_max_size: Taille max des fichiers
179 setting_attachment_max_size: Taille max des fichiers
177 setting_issues_export_limit: Limite export demandes
180 setting_issues_export_limit: Limite export demandes
178 setting_mail_from: Adresse d'Γ©mission
181 setting_mail_from: Adresse d'Γ©mission
@@ -446,6 +449,9 label_user_mail_option_all: "Pour tous les Γ©vΓ©nements de tous mes projets"
446 label_user_mail_option_selected: "Pour tous les Γ©vΓ©nements des projets sΓ©lectionnΓ©s..."
449 label_user_mail_option_selected: "Pour tous les Γ©vΓ©nements des projets sΓ©lectionnΓ©s..."
447 label_user_mail_option_none: "Seulement pour ce que je surveille ou Γ  quoi je participe"
450 label_user_mail_option_none: "Seulement pour ce que je surveille ou Γ  quoi je participe"
448 label_user_mail_no_self_notified: "Je ne veux pas Γͺtre notifiΓ© des changements que j'effectue"
451 label_user_mail_no_self_notified: "Je ne veux pas Γͺtre notifiΓ© des changements que j'effectue"
452 label_registration_activation_by_email: activation du compte par email
453 label_registration_manual_activation: activation manuelle du compte
454 label_registration_automatic_activation: activation automatique du compte
449
455
450 button_login: Connexion
456 button_login: Connexion
451 button_submit: Soumettre
457 button_submit: Soumettre
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -539,3 +539,9 mail_body_account_information: Your Redmine account information
539 setting_protocol: Protocol
539 setting_protocol: Protocol
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
541 setting_time_format: Time format
541 setting_time_format: Time format
542 label_registration_activation_by_email: account activation by email
543 mail_subject_account_activation_request: Redmine account activation request
544 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
545 label_registration_automatic_activation: automatic account activation
546 label_registration_manual_activation: manual account activation
547 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -170,7 +170,7 setting_app_subtitle: Application subtitle
170 setting_welcome_text: Welcome text
170 setting_welcome_text: Welcome text
171 setting_default_language: Default language
171 setting_default_language: Default language
172 setting_login_required: Authent. required
172 setting_login_required: Authent. required
173 setting_self_registration: Self-registration enabled
173 setting_self_registration: Self-registration
174 setting_attachment_max_size: Attachment max. size
174 setting_attachment_max_size: Attachment max. size
175 setting_issues_export_limit: Issues export limit
175 setting_issues_export_limit: Issues export limit
176 setting_mail_from: Emission mail address
176 setting_mail_from: Emission mail address
@@ -538,3 +538,9 setting_protocol: Protocol
538 mail_body_account_information: Your Redmine account information
538 mail_body_account_information: Your Redmine account information
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -539,3 +539,9 mail_body_account_information: Your Redmine account information
539 setting_protocol: Protocol
539 setting_protocol: Protocol
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
541 setting_time_format: Time format
541 setting_time_format: Time format
542 label_registration_activation_by_email: account activation by email
543 mail_subject_account_activation_request: Redmine account activation request
544 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
545 label_registration_automatic_activation: automatic account activation
546 label_registration_manual_activation: manual account activation
547 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Twoje konto w Redmine
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 mail_body_account_information: Your Redmine account information
538 setting_protocol: Protocol
538 setting_protocol: Protocol
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
539 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 setting_time_format: Time format
540 setting_time_format: Time format
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -538,3 +538,9 default_activity_development: Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ°
538 enumeration_issue_priorities: ΠŸΡ€ΠΈΠΎΡ€ΠΈΡ‚Π΅Ρ‚Ρ‹ Π·Π°Π΄Π°Ρ‡
538 enumeration_issue_priorities: ΠŸΡ€ΠΈΠΎΡ€ΠΈΡ‚Π΅Ρ‚Ρ‹ Π·Π°Π΄Π°Ρ‡
539 enumeration_doc_categories: ΠšΠ°Ρ‚Π΅Π³ΠΎΡ€ΠΈΠΈ Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ²
539 enumeration_doc_categories: ΠšΠ°Ρ‚Π΅Π³ΠΎΡ€ΠΈΠΈ Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ²
540 enumeration_activities: ДСйствия (ΡƒΡ‡Π΅Ρ‚ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ)
540 enumeration_activities: ДСйствия (ΡƒΡ‡Π΅Ρ‚ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ)
541 label_registration_activation_by_email: account activation by email
542 mail_subject_account_activation_request: Redmine account activation request
543 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
544 label_registration_automatic_activation: automatic account activation
545 label_registration_manual_activation: manual account activation
546 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -539,3 +539,9 button_copy: Copy
539 setting_protocol: Protocol
539 setting_protocol: Protocol
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
541 setting_time_format: Time format
541 setting_time_format: Time format
542 label_registration_activation_by_email: account activation by email
543 mail_subject_account_activation_request: Redmine account activation request
544 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
545 label_registration_automatic_activation: automatic account activation
546 label_registration_manual_activation: manual account activation
547 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -539,3 +539,9 mail_body_account_information: Your Redmine account information
539 setting_protocol: Protocol
539 setting_protocol: Protocol
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
540 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
541 setting_time_format: Time format
541 setting_time_format: Time format
542 label_registration_activation_by_email: account activation by email
543 mail_subject_account_activation_request: Redmine account activation request
544 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
545 label_registration_automatic_activation: automatic account activation
546 label_registration_manual_activation: manual account activation
547 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -541,3 +541,9 mail_body_account_information: Your Redmine account information
541 setting_protocol: Protocol
541 setting_protocol: Protocol
542 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
542 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
543 setting_time_format: Time format
543 setting_time_format: Time format
544 label_registration_activation_by_email: account activation by email
545 mail_subject_account_activation_request: Redmine account activation request
546 mail_body_account_activation_request: 'A new user (%s) has registered. His account his pending your approval:'
547 label_registration_automatic_activation: automatic account activation
548 label_registration_manual_activation: manual account activation
549 notice_account_pending: "Your account was created and is now pending administrator approval."
@@ -56,5 +56,46 class AccountTest < ActionController::IntegrationTest
56
56
57 log_user('jsmith', 'newpass')
57 log_user('jsmith', 'newpass')
58 assert_equal 0, Token.count
58 assert_equal 0, Token.count
59 end
59 end
60
61 def test_register_with_automatic_activation
62 Setting.self_registration = '3'
63
64 get 'account/register'
65 assert_response :success
66 assert_template 'account/register'
67
68 post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
69 :password => "newpass", :password_confirmation => "newpass"
70 assert_redirected_to 'account/login'
71 log_user('newuser', 'newpass')
72 end
73
74 def test_register_with_manual_activation
75 Setting.self_registration = '2'
76
77 post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
78 :password => "newpass", :password_confirmation => "newpass"
79 assert_redirected_to 'account/login'
80 assert !User.find_by_login('newuser').active?
81 end
82
83 def test_register_with_email_activation
84 Setting.self_registration = '1'
85 Token.delete_all
86
87 post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
88 :password => "newpass", :password_confirmation => "newpass"
89 assert_redirected_to 'account/login'
90 assert !User.find_by_login('newuser').active?
91
92 token = Token.find(:first)
93 assert_equal 'register', token.action
94 assert_equal 'newuser@foo.bar', token.user.mail
95 assert !token.expired?
96
97 get 'account/activate', :token => token.value
98 assert_redirected_to 'account/login'
99 log_user('newuser', 'newpass')
100 end
60 end
101 end
General Comments 0
You need to be logged in to leave comments. Login now