summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 4ed31c7edce..cd0754d7816 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -70,6 +70,7 @@ class User < ActiveRecord::Base
has_many :team_projects, through: :user_team_project_relationships
validates :name, presence: true
+ validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }
validates :bio, length: { within: 0..255 }
validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider}
validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0}
@@ -215,17 +216,6 @@ class User < ActiveRecord::Base
UsersProject.where(project_id: authorized_projects.map(&:id), user_id: self.id)
end
- # Returns a string for use as a Gitolite user identifier
- #
- # Note that Gitolite 2.x requires the following pattern for users:
- #
- # ^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$
- def identifier
- # Replace non-word chars with underscores, then make sure it starts with
- # valid chars
- email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '')
- end
-
def is_admin?
admin
end