Commit e1344a08 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1163 from tomykaira/bug_1009

Fix #1009 Replace all special characters in user's identity
parents 354d2438 03a2995e
module Account module Account
def identifier def identifier
email.gsub /[@.]/, "_" email.gsub /[^[:alnum:]]/, "_"
end end
def is_admin? def is_admin?
......
...@@ -22,6 +22,11 @@ describe User do ...@@ -22,6 +22,11 @@ describe User do
user.identifier.should == "test_mail_com" user.identifier.should == "test_mail_com"
end 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 it "should execute callback when force_random_password specified" do
user = User.new(:email => "test@mail.com", :force_random_password => true) user = User.new(:email => "test@mail.com", :force_random_password => true)
user.should_receive(:generate_password) user.should_receive(:generate_password)
......
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