Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
haukot committed Feb 12, 2014
1 parent 3d44fd0 commit 9d5fa9a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class User < ActiveRecord::Base
validates_format_of :first_name, with: /^[a-zA-Zа-яА-Я][a-zA-Zа-яА-Я '`-]{0,253}[a-zA-Zа-яА-Я]$/
validates_format_of :last_name, with: /^[a-zA-Zа-яА-Я][a-zA-Zа-яА-Я '`-]{0,253}[a-zA-Zа-яА-Я]$/
validates_format_of :city, with: /^[a-zA-Zа-яА-Я0-9 '`-]{0,255}$/
validates_format_of :company, with: /^[a-zA-Zа-яА-Я0-9 '`~!@#$%^&*()_+=\-"{}\[\]\/\\|;:,.?<>-]{0,255}$/
validates_format_of :company, with: /^[a-zA-Zа-яА-Я0-9 '`~\!@#\$\%\^\&\*\(\)_+=\-"\{\}\[\]\/\\|;:,.?<>]{0,255}$/
validates_format_of :position, with: /^[a-zA-Zа-яА-Я0-9 '`-]{0,255}$/

enumerize :role, in: [ :lector, :user ], default: :user
Expand Down
2 changes: 1 addition & 1 deletion app/types/user_password_confirmation_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class UserPasswordConfirmationType < User
validates_each :password do |record, attr, value|
unless value =~ /^.{8,30}$/ and value =~ /^.*[a-z]+.*$/ and
value =~ /^.*[A-Z]+.*$/ and value =~ /^.*[0-9]+.*$/ and
value =~ /^.*[`~!@#$%^&*()_+=\-{}\[\]\/\\|;:,.?<>-]+.*$/
value =~ /^.*[`~\!\@\#\$\%^&*\(\)_+=\-{}\[\]\/\\|;:,.?<>]+.*$/
record.errors.add(attr, I18n.t(:password_not_valid, scope: [:activerecord, :errors, :messages]))
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/types/user_registration_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class UserRegistrationType < User
validates_each :password do |record, attr, value|
unless value =~ /^.{8,30}$/ and value =~ /^.*[a-z]+.*$/ and
value =~ /^.*[A-Z]+.*$/ and value =~ /^.*[0-9]+.*$/ and
value =~ /^.*[`~!@#$%^&*()_+=\-{}\[\]\/\\|;:,.?<>-]+.*$/
value =~ /^.*[`~\!\@\#\$\%^&*\(\)_+=\-{}\[\]\/\\|;:,.?<>]+.*$/
record.errors.add(attr, I18n.t(:password_not_valid, scope: [:activerecord, :errors, :messages]))
end
end
Expand Down

0 comments on commit 9d5fa9a

Please sign in to comment.