##// 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 62 validates_length_of :firstname, :lastname, :maximum => 30
63 63 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
64 64 validates_length_of :mail, :maximum => 60, :allow_nil => true
65 validates_length_of :password, :minimum => 4, :allow_nil => true
66 65 validates_confirmation_of :password, :allow_nil => true
67 66
68 67 def before_create
@@ -297,7 +296,17 class User < ActiveRecord::Base
297 296 anonymous_user
298 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 310 # Return password digest
302 311 def self.hash_password(clear_password)
303 312 Digest::SHA1.hexdigest(clear_password || "")
@@ -11,7 +11,7
11 11
12 12 <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
13 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 16 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
17 17 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
@@ -9,7 +9,7
9 9
10 10 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
11 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 14 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15 15 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -15,6 +15,9
15 15 [l(:label_registration_automatic_activation), "3"]
16 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 21 <p><label><%= l(:label_password_lost) %></label>
19 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 27 <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
28 28 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
29 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 31 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
32 32 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
33 33 </div>
@@ -788,3 +788,4 bg:
788 788 text_wiki_page_reassign_children: Reassign child pages to this parent page
789 789 text_wiki_page_nullify_children: Keep child pages as root pages
790 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 821 text_wiki_page_reassign_children: Reassign child pages to this parent page
822 822 text_wiki_page_nullify_children: Keep child pages as root pages
823 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 791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 792 text_wiki_page_nullify_children: Keep child pages as root pages
793 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 794 text_wiki_page_reassign_children: Reassign child pages to this parent page
795 795 text_wiki_page_nullify_children: Keep child pages as root pages
796 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 821 text_wiki_page_reassign_children: Reassign child pages to this parent page
822 822 text_wiki_page_nullify_children: Keep child pages as root pages
823 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 820 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 821 text_wiki_page_nullify_children: Keep child pages as root pages
822 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 285 setting_file_max_size_displayed: Max size of text files displayed inline
286 286 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
287 287 setting_openid: Allow OpenID login and registration
288 setting_password_min_length: Minimum password length
288 289
289 290 permission_edit_project: Edit project
290 291 permission_select_project_modules: Select project modules
@@ -841,3 +841,4 es:
841 841 text_wiki_page_reassign_children: Reassign child pages to this parent page
842 842 text_wiki_page_nullify_children: Keep child pages as root pages
843 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 831 text_wiki_page_reassign_children: Reassign child pages to this parent page
832 832 text_wiki_page_nullify_children: Keep child pages as root pages
833 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 317 setting_file_max_size_displayed: Taille maximum des fichiers texte affichés en ligne
318 318 setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier"
319 319 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
320 setting_password_min_length: Longueur minimum des mots de passe
320 321
321 322 permission_edit_project: Modifier le projet
322 323 permission_select_project_modules: Choisir les modules
@@ -820,3 +820,4 gl:
820 820 text_wiki_page_reassign_children: Reassign child pages to this parent page
821 821 text_wiki_page_nullify_children: Keep child pages as root pages
822 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 803 text_wiki_page_reassign_children: Reassign child pages to this parent page
804 804 text_wiki_page_nullify_children: Keep child pages as root pages
805 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 826 text_wiki_page_reassign_children: Reassign child pages to this parent page
827 827 text_wiki_page_nullify_children: Keep child pages as root pages
828 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 806 text_wiki_page_reassign_children: Reassign child pages to this parent page
807 807 text_wiki_page_nullify_children: Keep child pages as root pages
808 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 819 text_wiki_page_reassign_children: Reassign child pages to this parent page
820 820 text_wiki_page_nullify_children: Keep child pages as root pages
821 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 850 text_wiki_page_reassign_children: Reassign child pages to this parent page
851 851 text_wiki_page_nullify_children: Keep child pages as root pages
852 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 831 text_wiki_page_reassign_children: Reassign child pages to this parent page
832 832 text_wiki_page_nullify_children: Keep child pages as root pages
833 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 776 text_wiki_page_reassign_children: Reassign child pages to this parent page
777 777 text_wiki_page_nullify_children: Keep child pages as root pages
778 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 793 text_wiki_page_reassign_children: Reassign child pages to this parent page
794 794 text_wiki_page_nullify_children: Keep child pages as root pages
795 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 824 text_wiki_page_reassign_children: Reassign child pages to this parent page
825 825 text_wiki_page_nullify_children: Keep child pages as root pages
826 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 826 text_wiki_page_reassign_children: Reassign child pages to this parent page
827 827 text_wiki_page_nullify_children: Keep child pages as root pages
828 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 812 text_wiki_page_reassign_children: Reassign child pages to this parent page
813 813 text_wiki_page_nullify_children: Keep child pages as root pages
814 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 791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 792 text_wiki_page_nullify_children: Keep child pages as root pages
793 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 918 text_wiki_page_reassign_children: Reassign child pages to this parent page
919 919 text_wiki_page_nullify_children: Keep child pages as root pages
920 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 792 text_wiki_page_reassign_children: Reassign child pages to this parent page
793 793 text_wiki_page_nullify_children: Keep child pages as root pages
794 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 790 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 791 text_wiki_page_nullify_children: Keep child pages as root pages
792 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 814 text_wiki_page_reassign_children: Reassign child pages to this parent page
815 815 text_wiki_page_nullify_children: Keep child pages as root pages
816 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 848 text_wiki_page_reassign_children: Reassign child pages to this parent page
849 849 text_wiki_page_nullify_children: Keep child pages as root pages
850 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 791 text_wiki_page_reassign_children: Reassign child pages to this parent page
792 792 text_wiki_page_nullify_children: Keep child pages as root pages
793 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 827 text_wiki_page_reassign_children: Reassign child pages to this parent page
828 828 text_wiki_page_nullify_children: Keep child pages as root pages
829 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 790 text_wiki_page_reassign_children: Reassign child pages to this parent page
791 791 text_wiki_page_nullify_children: Keep child pages as root pages
792 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 860 text_wiki_page_reassign_children: Reassign child pages to this parent page
861 861 text_wiki_page_nullify_children: Keep child pages as root pages
862 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 898 text_wiki_page_reassign_children: Reassign child pages to this parent page
899 899 text_wiki_page_nullify_children: Keep child pages as root pages
900 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 823 text_wiki_page_reassign_children: Reassign child pages to this parent page
824 824 text_wiki_page_nullify_children: Keep child pages as root pages
825 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 31 default: '2'
32 32 lost_password:
33 33 default: 1
34 password_min_length:
35 format: int
36 default: 4
34 37 attachment_max_size:
35 38 format: int
36 39 default: 5120
General Comments 0
You need to be logged in to leave comments. Login now