Fix #1009 Replace all special characters in user's identity
This commit is contained in:
parent
8b7e404b5b
commit
03a2995e15
2 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
module Account
|
||||
def identifier
|
||||
email.gsub /[@.]/, "_"
|
||||
email.gsub /[^[:alnum:]]/, "_"
|
||||
end
|
||||
|
||||
def is_admin?
|
||||
|
|
|
@ -22,6 +22,11 @@ describe User do
|
|||
user.identifier.should == "test_mail_com"
|
||||
end
|
||||
|
||||
it "should return identifier without + sign" do
|
||||
user = User.new(:email => "test+foo@mail.com")
|
||||
user.identifier.should == "test_foo_mail_com"
|
||||
end
|
||||
|
||||
it "should execute callback when force_random_password specified" do
|
||||
user = User.new(:email => "test@mail.com", :force_random_password => true)
|
||||
user.should_receive(:generate_password)
|
||||
|
|
Loading…
Reference in a new issue