##// END OF EJS Templates
Makes minimum password length configurable....
Jean-Philippe Lang -
r2586:31cf9be7abac
parent child
Show More
@@ -62,7 +62,6 class User < ActiveRecord::Base
62 validates_length_of :firstname, :lastname, :maximum => 30
62 validates_length_of :firstname, :lastname, :maximum => 30
63 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
63 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
64 validates_length_of :mail, :maximum => 60, :allow_nil => true
64 validates_length_of :mail, :maximum => 60, :allow_nil => true
65 validates_length_of :password, :minimum => 4, :allow_nil => true
66 validates_confirmation_of :password, :allow_nil => true
65 validates_confirmation_of :password, :allow_nil => true
67
66
68 def before_create
67 def before_create
@@ -297,7 +296,17 class User < ActiveRecord::Base
297 anonymous_user
296 anonymous_user
298 end
297 end
299
298
300 private
299 protected
300
301 def validate
302 # Password length validation based on setting
303 if !password.nil? && password.size < Setting.password_min_length.to_i
304 errors.add(:password, :too_short, :count => Setting.password_min_length.to_i)
305 end
306 end
307
308 private
309
301 # Return password digest
310 # Return password digest
302 def self.hash_password(clear_password)
311 def self.hash_password(clear_password)
303 Digest::SHA1.hexdigest(clear_password || "")
312 Digest::SHA1.hexdigest(clear_password || "")
@@ -11,7 +11,7
11
11
12 <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
12 <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
13 <%= password_field_tag 'password', nil, :size => 25 %><br />
13 <%= password_field_tag 'password', nil, :size => 25 %><br />
14 <em><%= l(:text_caracters_minimum, 4) %></em></p>
14 <em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
15
15
16 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
16 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
17 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
17 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
@@ -9,7 +9,7
9
9
10 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
10 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
11 <%= password_field_tag 'new_password', nil, :size => 25 %><br />
11 <%= password_field_tag 'new_password', nil, :size => 25 %><br />
12 <em><%= l(:text_caracters_minimum, 4) %></em></p>
12 <em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
13
13
14 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
14 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
15 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -15,6 +15,9
15 [l(:label_registration_automatic_activation), "3"]
15 [l(:label_registration_automatic_activation), "3"]
16 ], Setting.self_registration ) %></p>
16 ], Setting.self_registration ) %></p>
17
17
18 <p><label><%= l(:setting_password_min_length) %></label>
19 <%= text_field_tag 'settings[password_min_length]', Setting.password_min_length, :size => 6 %></p>
20
18 <p><label><%= l(:label_password_lost) %></label>
21 <p><label><%= l(:label_password_lost) %></label>
19 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
22 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
20
23
@@ -27,7 +27,7
27 <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
27 <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
28 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
28 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
29 <%= password_field_tag 'password', nil, :size => 25 %><br />
29 <%= password_field_tag 'password', nil, :size => 25 %><br />
30 <em><%= l(:text_caracters_minimum, 4) %></em></p>
30 <em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
31 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
31 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
32 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
32 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
33 </div>
33 </div>
@@ -788,3 +788,4 bg:
788 text_wiki_page_reassign_children: Reassign child pages to this parent page
788 text_wiki_page_reassign_children: Reassign child pages to this parent page
789 text_wiki_page_nullify_children: Keep child pages as root pages
789 text_wiki_page_nullify_children: Keep child pages as root pages
790 text_wiki_page_destroy_children: Delete child pages and all their descendants
790 text_wiki_page_destroy_children: Delete child pages and all their descendants
791 setting_password_min_length: Minimum password length
@@ -821,3 +821,4 bs:
821 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 text_wiki_page_reassign_children: Reassign child pages to this parent page
822 text_wiki_page_nullify_children: Keep child pages as root pages
822 text_wiki_page_nullify_children: Keep child pages as root pages
823 text_wiki_page_destroy_children: Delete child pages and all their descendants
823 text_wiki_page_destroy_children: Delete child pages and all their descendants
824 setting_password_min_length: Minimum password length
@@ -791,3 +791,4 ca:
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 text_wiki_page_nullify_children: Keep child pages as root pages
792 text_wiki_page_nullify_children: Keep child pages as root pages
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
794 setting_password_min_length: Minimum password length
@@ -794,3 +794,4 cs:
794 text_wiki_page_reassign_children: Reassign child pages to this parent page
794 text_wiki_page_reassign_children: Reassign child pages to this parent page
795 text_wiki_page_nullify_children: Keep child pages as root pages
795 text_wiki_page_nullify_children: Keep child pages as root pages
796 text_wiki_page_destroy_children: Delete child pages and all their descendants
796 text_wiki_page_destroy_children: Delete child pages and all their descendants
797 setting_password_min_length: Minimum password length
@@ -821,3 +821,4 da:
821 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 text_wiki_page_reassign_children: Reassign child pages to this parent page
822 text_wiki_page_nullify_children: Keep child pages as root pages
822 text_wiki_page_nullify_children: Keep child pages as root pages
823 text_wiki_page_destroy_children: Delete child pages and all their descendants
823 text_wiki_page_destroy_children: Delete child pages and all their descendants
824 setting_password_min_length: Minimum password length
@@ -820,3 +820,4 de:
820 text_wiki_page_reassign_children: Reassign child pages to this parent page
820 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 text_wiki_page_nullify_children: Keep child pages as root pages
821 text_wiki_page_nullify_children: Keep child pages as root pages
822 text_wiki_page_destroy_children: Delete child pages and all their descendants
822 text_wiki_page_destroy_children: Delete child pages and all their descendants
823 setting_password_min_length: Minimum password length
@@ -285,6 +285,7 en:
285 setting_file_max_size_displayed: Max size of text files displayed inline
285 setting_file_max_size_displayed: Max size of text files displayed inline
286 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
286 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
287 setting_openid: Allow OpenID login and registration
287 setting_openid: Allow OpenID login and registration
288 setting_password_min_length: Minimum password length
288
289
289 permission_edit_project: Edit project
290 permission_edit_project: Edit project
290 permission_select_project_modules: Select project modules
291 permission_select_project_modules: Select project modules
@@ -841,3 +841,4 es:
841 text_wiki_page_reassign_children: Reassign child pages to this parent page
841 text_wiki_page_reassign_children: Reassign child pages to this parent page
842 text_wiki_page_nullify_children: Keep child pages as root pages
842 text_wiki_page_nullify_children: Keep child pages as root pages
843 text_wiki_page_destroy_children: Delete child pages and all their descendants
843 text_wiki_page_destroy_children: Delete child pages and all their descendants
844 setting_password_min_length: Minimum password length
@@ -831,3 +831,4 fi:
831 text_wiki_page_reassign_children: Reassign child pages to this parent page
831 text_wiki_page_reassign_children: Reassign child pages to this parent page
832 text_wiki_page_nullify_children: Keep child pages as root pages
832 text_wiki_page_nullify_children: Keep child pages as root pages
833 text_wiki_page_destroy_children: Delete child pages and all their descendants
833 text_wiki_page_destroy_children: Delete child pages and all their descendants
834 setting_password_min_length: Minimum password length
@@ -317,6 +317,7 fr:
317 setting_file_max_size_displayed: Taille maximum des fichiers texte affichés en ligne
317 setting_file_max_size_displayed: Taille maximum des fichiers texte affichés en ligne
318 setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier"
318 setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier"
319 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
319 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
320 setting_password_min_length: Longueur minimum des mots de passe
320
321
321 permission_edit_project: Modifier le projet
322 permission_edit_project: Modifier le projet
322 permission_select_project_modules: Choisir les modules
323 permission_select_project_modules: Choisir les modules
@@ -820,3 +820,4 gl:
820 text_wiki_page_reassign_children: Reassign child pages to this parent page
820 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 text_wiki_page_nullify_children: Keep child pages as root pages
821 text_wiki_page_nullify_children: Keep child pages as root pages
822 text_wiki_page_destroy_children: Delete child pages and all their descendants
822 text_wiki_page_destroy_children: Delete child pages and all their descendants
823 setting_password_min_length: Minimum password length
@@ -803,3 +803,4 he:
803 text_wiki_page_reassign_children: Reassign child pages to this parent page
803 text_wiki_page_reassign_children: Reassign child pages to this parent page
804 text_wiki_page_nullify_children: Keep child pages as root pages
804 text_wiki_page_nullify_children: Keep child pages as root pages
805 text_wiki_page_destroy_children: Delete child pages and all their descendants
805 text_wiki_page_destroy_children: Delete child pages and all their descendants
806 setting_password_min_length: Minimum password length
@@ -826,3 +826,4
826 text_wiki_page_reassign_children: Reassign child pages to this parent page
826 text_wiki_page_reassign_children: Reassign child pages to this parent page
827 text_wiki_page_nullify_children: Keep child pages as root pages
827 text_wiki_page_nullify_children: Keep child pages as root pages
828 text_wiki_page_destroy_children: Delete child pages and all their descendants
828 text_wiki_page_destroy_children: Delete child pages and all their descendants
829 setting_password_min_length: Minimum password length
@@ -806,3 +806,4 it:
806 text_wiki_page_reassign_children: Reassign child pages to this parent page
806 text_wiki_page_reassign_children: Reassign child pages to this parent page
807 text_wiki_page_nullify_children: Keep child pages as root pages
807 text_wiki_page_nullify_children: Keep child pages as root pages
808 text_wiki_page_destroy_children: Delete child pages and all their descendants
808 text_wiki_page_destroy_children: Delete child pages and all their descendants
809 setting_password_min_length: Minimum password length
@@ -819,3 +819,4 ja:
819 text_wiki_page_reassign_children: Reassign child pages to this parent page
819 text_wiki_page_reassign_children: Reassign child pages to this parent page
820 text_wiki_page_nullify_children: Keep child pages as root pages
820 text_wiki_page_nullify_children: Keep child pages as root pages
821 text_wiki_page_destroy_children: Delete child pages and all their descendants
821 text_wiki_page_destroy_children: Delete child pages and all their descendants
822 setting_password_min_length: Minimum password length
@@ -850,3 +850,4 ko:
850 text_wiki_page_reassign_children: Reassign child pages to this parent page
850 text_wiki_page_reassign_children: Reassign child pages to this parent page
851 text_wiki_page_nullify_children: Keep child pages as root pages
851 text_wiki_page_nullify_children: Keep child pages as root pages
852 text_wiki_page_destroy_children: Delete child pages and all their descendants
852 text_wiki_page_destroy_children: Delete child pages and all their descendants
853 setting_password_min_length: Minimum password length
@@ -831,3 +831,4 lt:
831 text_wiki_page_reassign_children: Reassign child pages to this parent page
831 text_wiki_page_reassign_children: Reassign child pages to this parent page
832 text_wiki_page_nullify_children: Keep child pages as root pages
832 text_wiki_page_nullify_children: Keep child pages as root pages
833 text_wiki_page_destroy_children: Delete child pages and all their descendants
833 text_wiki_page_destroy_children: Delete child pages and all their descendants
834 setting_password_min_length: Minimum password length
@@ -776,3 +776,4 nl:
776 text_wiki_page_reassign_children: Reassign child pages to this parent page
776 text_wiki_page_reassign_children: Reassign child pages to this parent page
777 text_wiki_page_nullify_children: Keep child pages as root pages
777 text_wiki_page_nullify_children: Keep child pages as root pages
778 text_wiki_page_destroy_children: Delete child pages and all their descendants
778 text_wiki_page_destroy_children: Delete child pages and all their descendants
779 setting_password_min_length: Minimum password length
@@ -793,3 +793,4
793 text_wiki_page_reassign_children: Reassign child pages to this parent page
793 text_wiki_page_reassign_children: Reassign child pages to this parent page
794 text_wiki_page_nullify_children: Keep child pages as root pages
794 text_wiki_page_nullify_children: Keep child pages as root pages
795 text_wiki_page_destroy_children: Delete child pages and all their descendants
795 text_wiki_page_destroy_children: Delete child pages and all their descendants
796 setting_password_min_length: Minimum password length
@@ -824,3 +824,4 pl:
824 text_wiki_page_reassign_children: Reassign child pages to this parent page
824 text_wiki_page_reassign_children: Reassign child pages to this parent page
825 text_wiki_page_nullify_children: Keep child pages as root pages
825 text_wiki_page_nullify_children: Keep child pages as root pages
826 text_wiki_page_destroy_children: Delete child pages and all their descendants
826 text_wiki_page_destroy_children: Delete child pages and all their descendants
827 setting_password_min_length: Minimum password length
@@ -826,3 +826,4 pt-BR:
826 text_wiki_page_reassign_children: Reassign child pages to this parent page
826 text_wiki_page_reassign_children: Reassign child pages to this parent page
827 text_wiki_page_nullify_children: Keep child pages as root pages
827 text_wiki_page_nullify_children: Keep child pages as root pages
828 text_wiki_page_destroy_children: Delete child pages and all their descendants
828 text_wiki_page_destroy_children: Delete child pages and all their descendants
829 setting_password_min_length: Minimum password length
@@ -812,3 +812,4 pt:
812 text_wiki_page_reassign_children: Reassign child pages to this parent page
812 text_wiki_page_reassign_children: Reassign child pages to this parent page
813 text_wiki_page_nullify_children: Keep child pages as root pages
813 text_wiki_page_nullify_children: Keep child pages as root pages
814 text_wiki_page_destroy_children: Delete child pages and all their descendants
814 text_wiki_page_destroy_children: Delete child pages and all their descendants
815 setting_password_min_length: Minimum password length
@@ -791,3 +791,4 ro:
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 text_wiki_page_nullify_children: Keep child pages as root pages
792 text_wiki_page_nullify_children: Keep child pages as root pages
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
794 setting_password_min_length: Minimum password length
@@ -918,3 +918,4 ru:
918 text_wiki_page_reassign_children: Reassign child pages to this parent page
918 text_wiki_page_reassign_children: Reassign child pages to this parent page
919 text_wiki_page_nullify_children: Keep child pages as root pages
919 text_wiki_page_nullify_children: Keep child pages as root pages
920 text_wiki_page_destroy_children: Delete child pages and all their descendants
920 text_wiki_page_destroy_children: Delete child pages and all their descendants
921 setting_password_min_length: Minimum password length
@@ -792,3 +792,4 sk:
792 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 text_wiki_page_reassign_children: Reassign child pages to this parent page
793 text_wiki_page_nullify_children: Keep child pages as root pages
793 text_wiki_page_nullify_children: Keep child pages as root pages
794 text_wiki_page_destroy_children: Delete child pages and all their descendants
794 text_wiki_page_destroy_children: Delete child pages and all their descendants
795 setting_password_min_length: Minimum password length
@@ -790,3 +790,4 sl:
790 text_wiki_page_reassign_children: Reassign child pages to this parent page
790 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 text_wiki_page_nullify_children: Keep child pages as root pages
791 text_wiki_page_nullify_children: Keep child pages as root pages
792 text_wiki_page_destroy_children: Delete child pages and all their descendants
792 text_wiki_page_destroy_children: Delete child pages and all their descendants
793 setting_password_min_length: Minimum password length
@@ -814,3 +814,4
814 text_wiki_page_reassign_children: Reassign child pages to this parent page
814 text_wiki_page_reassign_children: Reassign child pages to this parent page
815 text_wiki_page_nullify_children: Keep child pages as root pages
815 text_wiki_page_nullify_children: Keep child pages as root pages
816 text_wiki_page_destroy_children: Delete child pages and all their descendants
816 text_wiki_page_destroy_children: Delete child pages and all their descendants
817 setting_password_min_length: Minimum password length
@@ -848,3 +848,4 sv:
848 text_wiki_page_reassign_children: Reassign child pages to this parent page
848 text_wiki_page_reassign_children: Reassign child pages to this parent page
849 text_wiki_page_nullify_children: Keep child pages as root pages
849 text_wiki_page_nullify_children: Keep child pages as root pages
850 text_wiki_page_destroy_children: Delete child pages and all their descendants
850 text_wiki_page_destroy_children: Delete child pages and all their descendants
851 setting_password_min_length: Minimum password length
@@ -791,3 +791,4 th:
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 text_wiki_page_nullify_children: Keep child pages as root pages
792 text_wiki_page_nullify_children: Keep child pages as root pages
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
793 text_wiki_page_destroy_children: Delete child pages and all their descendants
794 setting_password_min_length: Minimum password length
@@ -827,3 +827,4 tr:
827 text_wiki_page_reassign_children: Reassign child pages to this parent page
827 text_wiki_page_reassign_children: Reassign child pages to this parent page
828 text_wiki_page_nullify_children: Keep child pages as root pages
828 text_wiki_page_nullify_children: Keep child pages as root pages
829 text_wiki_page_destroy_children: Delete child pages and all their descendants
829 text_wiki_page_destroy_children: Delete child pages and all their descendants
830 setting_password_min_length: Minimum password length
@@ -790,3 +790,4 uk:
790 text_wiki_page_reassign_children: Reassign child pages to this parent page
790 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 text_wiki_page_nullify_children: Keep child pages as root pages
791 text_wiki_page_nullify_children: Keep child pages as root pages
792 text_wiki_page_destroy_children: Delete child pages and all their descendants
792 text_wiki_page_destroy_children: Delete child pages and all their descendants
793 setting_password_min_length: Minimum password length
@@ -860,3 +860,4 vi:
860 text_wiki_page_reassign_children: Reassign child pages to this parent page
860 text_wiki_page_reassign_children: Reassign child pages to this parent page
861 text_wiki_page_nullify_children: Keep child pages as root pages
861 text_wiki_page_nullify_children: Keep child pages as root pages
862 text_wiki_page_destroy_children: Delete child pages and all their descendants
862 text_wiki_page_destroy_children: Delete child pages and all their descendants
863 setting_password_min_length: Minimum password length
@@ -898,3 +898,4
898 text_wiki_page_reassign_children: Reassign child pages to this parent page
898 text_wiki_page_reassign_children: Reassign child pages to this parent page
899 text_wiki_page_nullify_children: Keep child pages as root pages
899 text_wiki_page_nullify_children: Keep child pages as root pages
900 text_wiki_page_destroy_children: Delete child pages and all their descendants
900 text_wiki_page_destroy_children: Delete child pages and all their descendants
901 setting_password_min_length: Minimum password length
@@ -823,3 +823,4 zh:
823 text_wiki_page_reassign_children: Reassign child pages to this parent page
823 text_wiki_page_reassign_children: Reassign child pages to this parent page
824 text_wiki_page_nullify_children: Keep child pages as root pages
824 text_wiki_page_nullify_children: Keep child pages as root pages
825 text_wiki_page_destroy_children: Delete child pages and all their descendants
825 text_wiki_page_destroy_children: Delete child pages and all their descendants
826 setting_password_min_length: Minimum password length
@@ -31,6 +31,9 self_registration:
31 default: '2'
31 default: '2'
32 lost_password:
32 lost_password:
33 default: 1
33 default: 1
34 password_min_length:
35 format: int
36 default: 4
34 attachment_max_size:
37 attachment_max_size:
35 format: int
38 format: int
36 default: 5120
39 default: 5120
General Comments 0
You need to be logged in to leave comments. Login now