summaryrefslogtreecommitdiff
path: root/app/roles/account.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/roles/account.rb')
-rw-r--r--app/roles/account.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/roles/account.rb b/app/roles/account.rb
index 63a9b5c51bf..b8c445a3d58 100644
--- a/app/roles/account.rb
+++ b/app/roles/account.rb
@@ -1,6 +1,13 @@
-module Account
+module Account
+ # 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
- email.gsub /[^[:alnum:]]/, "_"
+ # Replace non-word chars with underscores, then make sure it starts with
+ # valid chars
+ email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '')
end
def is_admin?