Commit d8b3c327 authored by Corey Hinshaw's avatar Corey Hinshaw

AuthHash should not parameterize email user

parent 66706570
......@@ -62,7 +62,7 @@ module Gitlab
# Get the first part of the email address (before @)
# In addtion in removes illegal characters
def generate_username(email)
email.match(/^[^@]*/)[0].parameterize
email.match(/^[^@]*/)[0].mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/,'').to_s
end
def generate_temporarily_email(username)
......
......@@ -14,7 +14,7 @@ describe Gitlab::OAuth::AuthHash, lib: true do
let(:uid_raw) do
"CN=Onur K\xC3\xBC\xC3\xA7\xC3\xBCk,OU=Test,DC=example,DC=net"
end
let(:email_raw) { "onur.k\xC3\xBC\xC3\xA7\xC3\xBCk@example.net" }
let(:email_raw) { "onur.k\xC3\xBC\xC3\xA7\xC3\xBCk_ABC-123@example.net" }
let(:nickname_raw) { "ok\xC3\xBC\xC3\xA7\xC3\xBCk" }
let(:first_name_raw) { 'Onur' }
let(:last_name_raw) { "K\xC3\xBC\xC3\xA7\xC3\xBCk" }
......@@ -66,7 +66,7 @@ describe Gitlab::OAuth::AuthHash, lib: true do
before { info_hash.delete(:nickname) }
it 'takes the first part of the email as username' do
expect(auth_hash.username).to eql 'onur-kucuk'
expect(auth_hash.username).to eql 'onur.kucuk_ABC-123'
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment