[congruity] Include upstream commits to fix login traceback (#1190230)

Scott Talbert swt2c at fedoraproject.org
Sun Mar 8 22:32:24 UTC 2015


commit 576ff65cf5999caf1e0fcc9848d3e26cf30cab14
Author: Scott Talbert <swt at techie.net>
Date:   Sun Mar 8 18:31:44 2015 -0400

    Include upstream commits to fix login traceback (#1190230)

 congruity.spec    |  8 ++++-
 login_fixes.patch | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 1 deletion(-)
---
diff --git a/congruity.spec b/congruity.spec
index 8392580..f89346b 100644
--- a/congruity.spec
+++ b/congruity.spec
@@ -1,6 +1,6 @@
 Name:		congruity
 Version:	18
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	Applications to program Logitech Harmony universal remote controls
 
 Group:		Applications/System
@@ -10,6 +10,8 @@ URL:		http://sourceforge.net/projects/congruity
 Source0:	http://downloads.sourceforge.net/congruity/%{name}-%{version}.tar.bz2
 # Include upstream patch to add wxPython 3.0 support
 Patch0:		wxpython3.0.patch
+# Set of commits 10dcea10, dc2b37f7, aff7ea13, 47a612de to fix login issues.
+Patch1:		login_fixes.patch
 BuildArch:	noarch
 
 BuildRequires:	desktop-file-utils
@@ -36,6 +38,7 @@ This includes the Harmony 200 and Harmony 300. To use it, simply run
 %prep
 %setup -q
 %patch0 -p1 -b .wxpython3.0
+%patch1 -p1 -b .login_fixes
 
 %build
 
@@ -60,6 +63,9 @@ update-desktop-database &> /dev/null || :
 %{_mandir}/*/*
 
 %changelog
+* Sun Mar 08 2015 Scott Talbert <swt at techie.net> - 18-4
+- Include upstream commits to fix login traceback (#1190230)
+
 * Wed Dec 31 2014 Scott Talbert <swt at techie.net> - 18-3
 - Include upstream patch for wxPython 3.0 support (#1177990)
 
diff --git a/login_fixes.patch b/login_fixes.patch
new file mode 100644
index 0000000..2715a79
--- /dev/null
+++ b/login_fixes.patch
@@ -0,0 +1,90 @@
+Login fixes.  Includes commits 10dcea10, dc2b37f7, aff7ea13, 47a612de.
+
+diff --git a/mhgui b/mhgui
+index f95bee5..1c8746d 100755
+--- a/mhgui
++++ b/mhgui
+@@ -248,8 +248,13 @@ class WelcomePanel(WizardPanelBase):
+         if loginResult is True:
+             self.parent._SetPage(self.next, True, True)
+         else:
+-            wx.MessageBox('Login failed.', 'Login failed.', wx.OK |
+-                          wx.ICON_WARNING)
++            if loginResult is None:
++                msg = 'You appear to have used a members.harmonyremote.com ' \
++                      'account.  Please create a myharmony.com account or ' \
++                      'login with an existing one.'
++            else:
++                msg = 'Login failed.  Username or password incorrect.'
++            wx.MessageBox(msg, 'Login Failed', wx.OK | wx.ICON_WARNING)
+             self.usernameCtrl.Clear()
+             self.passwordCtrl.Clear()
+ 
+diff --git a/mhmanager.py b/mhmanager.py
+index e65a098..904085c 100644
+--- a/mhmanager.py
++++ b/mhmanager.py
+@@ -30,6 +30,7 @@ import os
+ import sys
+ import random
+ import datetime
++import json
+ from HTMLParser import HTMLParser
+ from suds.cache import ObjectCache
+ from suds.client import Client
+@@ -153,16 +154,35 @@ class MHManager():
+             logging.basicConfig(level=logging.INFO)
+             logging.getLogger('suds.transport').setLevel(logging.DEBUG)
+         self.client = Client(url, cache=cache, plugins=[MHPlugin()])
+-        self.logged_in = False
+ 
+-    # Log in to web service - Returns True if login succeeded, False otherwise.
++    # Log in to web service - returns True if login succeeded, False if login
++    # failed, and None if the account appears to be a members.harmonyremote.com
++    # account.
+     def Login(self, email, password):
+-        self.logged_in = self.client.service['Security'].LoginUser(
+-            email=email, password=password, customCredential='',
+-            isPresistent=False)
++        baseUrl = "https://setup.myharmony.com"
++        url = baseUrl + "/Home/TestLogin"
++        params = urllib.urlencode({'username': email, 'password': password})
++        request = urllib2.Request(url, params)
++        response = urllib2.urlopen(request)
++        jsonResponse = json.loads(response.read())
++        if jsonResponse["Result"] == False:
++            return False
++        elif jsonResponse["Token"] is None: # members.harmonyremote.com acct
++            return None
++        self.client.options.transport.cookiejar.extract_cookies(response,
++                                                                request)
++
++        url = baseUrl + "/Home/Login?usr=" + jsonResponse["Token"]
++        request = urllib2.Request(url)
++        response = urllib2.urlopen(request)
++        parser = LoginResponseHTMLParser()
++        parser.feed(response.read())
++        initparams = dict(u.split("=", 1) for u in parser.initparams.split(","))
++        self.contentServiceAuthKey = initparams['ContentServiceAuthKey']
++
+         self.email = email
+         self.password = password
+-        return self.logged_in is not None
++        return True
+ 
+     # Gets the household info.
+     def GetHousehold(self):
+@@ -910,6 +930,13 @@ class MHAccountDetails:
+         securityAnswer = ""
+         keepMeInformed = ""
+ 
++class LoginResponseHTMLParser(HTMLParser):
++    def handle_starttag(self, tag, attrs):
++        if tag == 'param' and ('name', 'initparams') in attrs:
++            for key, value in attrs:
++                if key == 'value':
++                    self.initparams = value
++
+ class CreateAccountResponseHTMLParser(HTMLParser):
+     def __init__(self):
+         HTMLParser.__init__(self)


More information about the scm-commits mailing list