Take handle validations out of em-webfinger

This commit is contained in:
Raphael 2010-11-16 16:14:04 -08:00
parent 7876da8fb8
commit 538c6ce4b9
2 changed files with 3 additions and 2 deletions

View file

@ -8,9 +8,9 @@ class EMWebfinger
@callbacks = []
@ssl = true
# Raise an error if identifier has a port number
raise "Identifier is invalid" if(@account.strip.match(/\:\d+$/))
#raise "Identifier is invalid" if(@account.strip.match(/\:\d+$/))
# Raise an error if identifier is not a valid email (generous regexp)
raise "Identifier is invalid" if !(@account=~ /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)
#raise "Identifier is invalid" if !(@account=~ /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)
end
def fetch
raise 'you need to set a callback before calling fetch' if @callbacks.empty?

View file

@ -43,6 +43,7 @@ describe EMWebfinger do
end
it 'should not allow port numbers' do
pending
proc{
EMWebfinger.new('eviljoe@diaspora.local:3000')
}.should raise_error(RuntimeError, "Identifier is invalid")