Fixed: User#identity_url raises an error when invalid url is supplied (#2742).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2476 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-02-15 18:46:50 +00:00
parent 3183445aea
commit d643d9a94c
2 changed files with 19 additions and 4 deletions
+8 -4
View File
@@ -81,10 +81,14 @@ class User < ActiveRecord::Base
end
def identity_url=(url)
begin
self.write_attribute(:identity_url, OpenIdAuthentication.normalize_identifier(url))
rescue InvalidOpenId
# Invlaid url, don't save
if url.blank?
write_attribute(:identity_url, '')
else
begin
write_attribute(:identity_url, OpenIdAuthentication.normalize_identifier(url))
rescue OpenIdAuthentication::InvalidOpenId
# Invlaid url, don't save
end
end
self.read_attribute(:identity_url)
end