Update User#identifier to conform to Gitolite 2.x's user pattern
Also modifies the specs a bit because I can't help myself. Closes #480
This commit is contained in:
parent
b44e9a08d5
commit
d29827433d
3 changed files with 47 additions and 30 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue