lib/graybook/importer/hotmail.rb in graybook-1.0.24 vs lib/graybook/importer/hotmail.rb in graybook-1.1.0
- old
+ new
@@ -49,12 +49,11 @@
page = agent.submit(form)
# Check for login success
if page.body =~ /The e-mail address or password is incorrect/ ||
page.body =~ /Sign in failed\./
- raise( Graybook::BadCredentialsError,
- "That username and password was not accepted. Please check them and try again." )
+ return Problem.new("Username and password were not accepted. Please check them and try again.")
end
@first_page = agent.get( page.body.scan(/http\:\/\/[^"]+/).first )
end
@@ -66,15 +65,14 @@
end
##
# Scrape contacts for Hotmail
# Seems like a POST to directly fetch CSV contacts from options.aspx?subsection=26&n=
- # raises an end of file error in Net::HTTP via Mechanize.
# Seems like Hotmail addresses are now hosted on Windows Live.
def scrape_contacts
unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}
- raise( Graybook::BadCredentialsError, "Must be authenticated to access contacts." )
+ return Problem.new("Username and password were not accepted. Please check them and try again.")
end
page = agent.get('http://mail.live.com/')
if page.iframes.detect { |f| f.src =~ /\/mail\/TodayLight.aspx/ }