##// 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 validates_uniqueness_of :name, :identifier
35 validates_uniqueness_of :name, :identifier
36 validates_associated :custom_values, :on => :update
36 validates_associated :custom_values, :on => :update
37 validates_associated :repository, :wiki
37 validates_associated :repository, :wiki
38 validates_length_of :name, :maximum => 30
38 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
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 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
42 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
41
43
42 def identifier=(identifier)
44 def identifier=(identifier)
@@ -33,9 +33,12 class User < ActiveRecord::Base
33 validates_presence_of :login, :firstname, :lastname, :mail
33 validates_presence_of :login, :firstname, :lastname, :mail
34 validates_uniqueness_of :login, :mail
34 validates_uniqueness_of :login, :mail
35 # Login must contain lettres, numbers, underscores only
35 # Login must contain lettres, numbers, underscores only
36 validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
37 validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
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 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
40 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
41 validates_length_of :mail, :maximum => 60
39 # Password length between 4 and 12
42 # Password length between 4 and 12
40 validates_length_of :password, :in => 4..12, :allow_nil => true
43 validates_length_of :password, :in => 4..12, :allow_nil => true
41 validates_confirmation_of :password, :allow_nil => true
44 validates_confirmation_of :password, :allow_nil => true
@@ -9,7 +9,8
9 <% form_tag({:token => @token.value}, :class => "tabular") do %>
9 <% form_tag({:token => @token.value}, :class => "tabular") do %>
10
10
11 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
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 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15 <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>
16 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -35,7 +35,8
35 <%= password_field_tag 'password', nil, :size => 25 %></p>
35 <%= password_field_tag 'password', nil, :size => 25 %></p>
36
36
37 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
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 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
41 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
41 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
42 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
@@ -2,14 +2,14
2
2
3 <div class="box">
3 <div class="box">
4 <!--[form:project]-->
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 <% if admin_loggedin? and !@root_projects.empty? %>
7 <% if admin_loggedin? and !@root_projects.empty? %>
8 <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
8 <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
9 <% end %>
9 <% end %>
10
10
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></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_project_identifier_info) unless @project.identifier_frozen? %></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 <p><%= f.text_field :homepage, :size => 40 %></p>
13 <p><%= f.text_field :homepage, :size => 40 %></p>
14 <p><%= f.check_box :is_public %></p>
14 <p><%= f.check_box :is_public %></p>
15
15
@@ -23,7 +23,8
23 <p><%= f.select :auth_source_id, [[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] } %></p>
23 <p><%= f.select :auth_source_id, [[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] } %></p>
24 <% end %>
24 <% end %>
25 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
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 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
28 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
28 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
29 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
29 </div>
30 </div>
@@ -397,7 +397,9 text_journal_deleted: gelöscht
397 text_tip_task_begin_day: Aufgabe, die an diesem Tag beginnt
397 text_tip_task_begin_day: Aufgabe, die an diesem Tag beginnt
398 text_tip_task_end_day: Aufgabe, die an diesem Tag beendet
398 text_tip_task_end_day: Aufgabe, die an diesem Tag beendet
399 text_tip_task_begin_end_day: Aufgabe, die an diesem Tag beginnt und beendet
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 default_role_manager: Manager
404 default_role_manager: Manager
403 default_role_developper: Developer
405 default_role_developper: Developer
@@ -397,7 +397,9 text_journal_deleted: deleted
397 text_tip_task_begin_day: task beginning this day
397 text_tip_task_begin_day: task beginning this day
398 text_tip_task_end_day: task ending this day
398 text_tip_task_end_day: task ending this day
399 text_tip_task_begin_end_day: task beginning and ending this day
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 default_role_manager: Manager
404 default_role_manager: Manager
403 default_role_developper: Developer
405 default_role_developper: Developer
@@ -397,7 +397,9 text_journal_deleted: suprimido
397 text_tip_task_begin_day: tarea que comienza este día
397 text_tip_task_begin_day: tarea que comienza este día
398 text_tip_task_end_day: tarea que termina este día
398 text_tip_task_end_day: tarea que termina este día
399 text_tip_task_begin_end_day: tarea que comienza y termina este día
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 default_role_manager: Manager
404 default_role_manager: Manager
403 default_role_developper: Desarrollador
405 default_role_developper: Desarrollador
@@ -397,7 +397,9 text_journal_deleted: supprimé
397 text_tip_task_begin_day: tâche commençant ce jour
397 text_tip_task_begin_day: tâche commençant ce jour
398 text_tip_task_end_day: tâche finissant ce jour
398 text_tip_task_end_day: tâche finissant ce jour
399 text_tip_task_begin_end_day: tâche commençant et finissant ce jour
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 default_role_manager: Manager
404 default_role_manager: Manager
403 default_role_developper: Développeur
405 default_role_developper: Développeur
@@ -397,7 +397,9 text_journal_deleted: deleted
397 text_tip_task_begin_day: task beginning this day
397 text_tip_task_begin_day: task beginning this day
398 text_tip_task_end_day: task ending this day
398 text_tip_task_end_day: task ending this day
399 text_tip_task_begin_end_day: task beginning and ending this day
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 default_role_manager: Manager
404 default_role_manager: Manager
403 default_role_developper: Sviluppatore
405 default_role_developper: Sviluppatore
@@ -398,7 +398,9 text_journal_deleted: 削除
398 text_tip_task_begin_day: この日に開始するタスク
398 text_tip_task_begin_day: この日に開始するタスク
399 text_tip_task_end_day: この日に終了するタスク
399 text_tip_task_end_day: この日に終了するタスク
400 text_tip_task_begin_end_day: この日のうちに開始して終了するタスク
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 default_role_manager: 管理者
405 default_role_manager: 管理者
404 default_role_developper: 開発者
406 default_role_developper: 開発者
@@ -400,7 +400,9 text_journal_deleted: 已删除
400 text_tip_task_begin_day: 开始于此
400 text_tip_task_begin_day: 开始于此
401 text_tip_task_end_day: 在此结束
401 text_tip_task_end_day: 在此结束
402 text_tip_task_begin_end_day: 开始并结束于此
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 default_role_manager: 管理员
407 default_role_manager: 管理员
406 default_role_developper: 开发人员
408 default_role_developper: 开发人员
General Comments 0
You need to be logged in to leave comments. Login now