Commit e1344a08f0a1ced0a858b3b4503c7881276d014b

Authored by Dmitriy Zaporozhets
2 parents 354d2438 03a2995e

Merge pull request #1163 from tomykaira/bug_1009

Fix #1009 Replace all special characters in user's identity
app/roles/account.rb
1 1 module Account
2 2 def identifier
3   - email.gsub /[@.]/, "_"
  3 + email.gsub /[^[:alnum:]]/, "_"
4 4 end
5 5  
6 6 def is_admin?
... ...
spec/models/user_spec.rb
... ... @@ -22,6 +22,11 @@ describe User do
22 22 user.identifier.should == "test_mail_com"
23 23 end
24 24  
  25 + it "should return identifier without + sign" do
  26 + user = User.new(:email => "test+foo@mail.com")
  27 + user.identifier.should == "test_foo_mail_com"
  28 + end
  29 +
25 30 it "should execute callback when force_random_password specified" do
26 31 user = User.new(:email => "test@mail.com", :force_random_password => true)
27 32 user.should_receive(:generate_password)
... ...