Commit 03a2995e15e69ad1ec73b1c0ecefaf3d2551b0da

Authored by tomykaira
1 parent 8b7e404b

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)
... ...