From 8f418a7690097ccf7e7e318ff3b1a73d3ca33628 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 3 Nov 2014 11:57:04 -0600 Subject: [PATCH] Fixing password only for fimf password protected stories on web service. --- login.html | 44 ++++++++++++++++++++++++++------------------ main.py | 6 ++++-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/login.html b/login.html index 1eb146e..f0e27aa 100644 --- a/login.html +++ b/login.html @@ -50,24 +50,32 @@
{% if is_login %} - -

Login and Password

-
- {{ site }} requires a Login/Password for this story. - You need to provide your Login/Password for {{ site }} - to download it. -
-
-
Login
-
-
- -
-
Password
-
-
- - {% else %} + + {% if is_passwdonly %} +

Password

+
+ {{ site }} requires a Password for this story.
+ You need to provide the Password for this story + to download it. +
+ {% else %} +

Login / Password

+
+ {{ site }} requires a Login/Password for this story.
+ You need to provide your Login/Password for {{ site }} + to download it. +
+
+
Login
+
+
+ {% endif %} +
+
Password
+
+
+ + {% else %} diff --git a/main.py b/main.py index 2a789b4..ee18b6d 100644 --- a/main.py +++ b/main.py @@ -387,7 +387,7 @@ class FanfictionDownloader(UserConfigServer): adapter = adapters.getAdapter(configuration,url) logging.info('Created an adaper: %s' % adapter) - if len(login) > 1: + if login or password: adapter.username=login adapter.password=password adapter.is_adult=is_adult @@ -427,12 +427,14 @@ class FanfictionDownloader(UserConfigServer): download.put() logging.info(unicode(e)) is_login= ( isinstance(e, exceptions.FailedToLogin) ) + is_passwdonly = is_login and e.passwdonly template_values = dict(nickname = user.nickname(), url = url, format = format, site = adapter.getConfigSection(), fic = download, is_login=is_login, + is_passwdonly=is_passwdonly ) # thewriterscoffeeshop.com can do adult check *and* user required. if isinstance(e,exceptions.AdultCheckRequired): @@ -491,7 +493,7 @@ class FanfictionDownloaderTask(UserConfigServer): logging.info('Created an adapter: %s' % adapter) - if len(login) > 1: + if login or password: adapter.username=login adapter.password=password adapter.is_adult=is_adult