Take handle validations out of em-webfinger
This commit is contained in:
parent
7876da8fb8
commit
538c6ce4b9
2 changed files with 3 additions and 2 deletions
|
|
@ -8,9 +8,9 @@ class EMWebfinger
|
||||||
@callbacks = []
|
@callbacks = []
|
||||||
@ssl = true
|
@ssl = true
|
||||||
# Raise an error if identifier has a port number
|
# 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 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
|
end
|
||||||
def fetch
|
def fetch
|
||||||
raise 'you need to set a callback before calling fetch' if @callbacks.empty?
|
raise 'you need to set a callback before calling fetch' if @callbacks.empty?
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ describe EMWebfinger do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not allow port numbers' do
|
it 'should not allow port numbers' do
|
||||||
|
pending
|
||||||
proc{
|
proc{
|
||||||
EMWebfinger.new('eviljoe@diaspora.local:3000')
|
EMWebfinger.new('eviljoe@diaspora.local:3000')
|
||||||
}.should raise_error(RuntimeError, "Identifier is invalid")
|
}.should raise_error(RuntimeError, "Identifier is invalid")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue