##// END OF EJS Templates
Added some attributes length validations....
Jean-Philippe Lang -
r397:791077c240f7
parent child
Show More
@@ -35,8 +35,10 class Project < ActiveRecord::Base
35 35 validates_uniqueness_of :name, :identifier
36 36 validates_associated :custom_values, :on => :update
37 37 validates_associated :repository, :wiki
38 validates_length_of :name, :maximum => 30
38 39 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
39 validates_length_of :identifier, :maximum => 12
40 validates_length_of :description, :maximum => 255
41 validates_length_of :identifier, :in => 3..12
40 42 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
41 43
42 44 def identifier=(identifier)
@@ -33,9 +33,12 class User < ActiveRecord::Base
33 33 validates_presence_of :login, :firstname, :lastname, :mail
34 34 validates_uniqueness_of :login, :mail
35 35 # Login must contain lettres, numbers, underscores only
36 validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
37 36 validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
37 validates_length_of :login, :maximum => 30
38 validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
39 validates_length_of :firstname, :lastname, :maximum => 30
38 40 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
41 validates_length_of :mail, :maximum => 60
39 42 # Password length between 4 and 12
40 43 validates_length_of :password, :in => 4..12, :allow_nil => true
41 44 validates_confirmation_of :password, :allow_nil => true
@@ -9,7 +9,8
9 9 <% form_tag({:token => @token.value}, :class => "tabular") do %>
10 10
11 11 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
12 <%= password_field_tag 'new_password', nil, :size => 25 %></p>
12 <%= password_field_tag 'new_password', nil, :size => 25 %><br />
13 <em><%= l(:text_length_between, 4, 12) %></em></p>
13 14
14 15 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15 16 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -35,7 +35,8
35 35 <%= password_field_tag 'password', nil, :size => 25 %></p>
36 36
37 37 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
38 <%= password_field_tag 'new_password', nil, :size => 25 %></p>
38 <%= password_field_tag 'new_password', nil, :size => 25 %><br />
39 <em><%= l(:text_length_between, 4, 12) %></em></p>
39 40
40 41 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
41 42 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -2,14 +2,14
2 2
3 3 <div class="box">
4 4 <!--[form:project]-->
5 <p><%= f.text_field :name, :required => true %></p>
5 <p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
6 6
7 7 <% if admin_loggedin? and !@root_projects.empty? %>
8 8 <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
9 9 <% end %>
10 10
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p>
12 <p><%= f.text_field :identifier, :required => true, :size => 15, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %><br /><em><%= l(:text_caracters_maximum, 255) %></em></p>
12 <p><%= f.text_field :identifier, :required => true, :size => 15, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_length_between, 3, 12) %> <%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
13 13 <p><%= f.text_field :homepage, :size => 40 %></p>
14 14 <p><%= f.check_box :is_public %></p>
15 15
@@ -23,7 +23,8
23 23 <p><%= f.select :auth_source_id, [[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] } %></p>
24 24 <% end %>
25 25 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
26 <%= password_field_tag 'password', nil, :size => 25 %></p>
26 <%= password_field_tag 'password', nil, :size => 25 %><br />
27 <em><%= l(:text_length_between, 4, 12) %></em></p>
27 28 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
28 29 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
29 30 </div>
@@ -397,7 +397,9 text_journal_deleted: gelöscht
397 397 text_tip_task_begin_day: Aufgabe, die an diesem Tag beginnt
398 398 text_tip_task_end_day: Aufgabe, die an diesem Tag beendet
399 399 text_tip_task_begin_end_day: Aufgabe, die an diesem Tag beginnt und beendet
400 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
400 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
401 text_caracters_maximum: %d characters maximum.
402 text_length_between: Length between %d and %d characters.
401 403
402 404 default_role_manager: Manager
403 405 default_role_developper: Developer
@@ -397,7 +397,9 text_journal_deleted: deleted
397 397 text_tip_task_begin_day: task beginning this day
398 398 text_tip_task_end_day: task ending this day
399 399 text_tip_task_begin_end_day: task beginning and ending this day
400 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
400 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
401 text_caracters_maximum: %d characters maximum.
402 text_length_between: Length between %d and %d characters.
401 403
402 404 default_role_manager: Manager
403 405 default_role_developper: Developer
@@ -397,7 +397,9 text_journal_deleted: suprimido
397 397 text_tip_task_begin_day: tarea que comienza este día
398 398 text_tip_task_end_day: tarea que termina este día
399 399 text_tip_task_begin_end_day: tarea que comienza y termina este día
400 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
400 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
401 text_caracters_maximum: %d characters maximum.
402 text_length_between: Length between %d and %d characters.
401 403
402 404 default_role_manager: Manager
403 405 default_role_developper: Desarrollador
@@ -397,7 +397,9 text_journal_deleted: supprimé
397 397 text_tip_task_begin_day: tâche commençant ce jour
398 398 text_tip_task_end_day: tâche finissant ce jour
399 399 text_tip_task_begin_end_day: tâche commençant et finissant ce jour
400 text_project_identifier_info: '12 caractères maximum. Lettres (a-z), chiffres (0-9) et tirets autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.'
400 text_project_identifier_info: 'Lettres minuscules (a-z), chiffres et tirets autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.'
401 text_caracters_maximum: %d caractères maximum.
402 text_length_between: Longueur comprise entre %d et %d caractères.
401 403
402 404 default_role_manager: Manager
403 405 default_role_developper: Développeur
@@ -397,7 +397,9 text_journal_deleted: deleted
397 397 text_tip_task_begin_day: task beginning this day
398 398 text_tip_task_end_day: task ending this day
399 399 text_tip_task_begin_end_day: task beginning and ending this day
400 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
400 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
401 text_caracters_maximum: %d characters maximum.
402 text_length_between: Length between %d and %d characters.
401 403
402 404 default_role_manager: Manager
403 405 default_role_developper: Sviluppatore
@@ -398,7 +398,9 text_journal_deleted: 削除
398 398 text_tip_task_begin_day: この日に開始するタスク
399 399 text_tip_task_end_day: この日に終了するタスク
400 400 text_tip_task_begin_end_day: この日のうちに開始して終了するタスク
401 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
401 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
402 text_caracters_maximum: %d characters maximum.
403 text_length_between: Length between %d and %d characters.
402 404
403 405 default_role_manager: 管理者
404 406 default_role_developper: 開発者
@@ -400,7 +400,9 text_journal_deleted: 已删除
400 400 text_tip_task_begin_day: 开始于此
401 401 text_tip_task_end_day: 在此结束
402 402 text_tip_task_begin_end_day: 开始并结束于此
403 text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
403 text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
404 text_caracters_maximum: %d characters maximum.
405 text_length_between: Length between %d and %d characters.
404 406
405 407 default_role_manager: 管理员
406 408 default_role_developper: 开发人员
General Comments 0
You need to be logged in to leave comments. Login now