Skip to content

Commit b6cf21f

Browse files
committed
Fixed #78 -- cookie cleanup before login.
1 parent 06c4347 commit b6cf21f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

client/deis.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ def __init__(self):
7777
self.cookies.load()
7878
self.cookies.clear_expired_cookies()
7979

80+
def clear(self, domain):
81+
"""Clear cookies for the specified domain."""
82+
try:
83+
self.cookies.clear(domain)
84+
self.cookies.save()
85+
except KeyError:
86+
pass
87+
8088
def git_root(self):
8189
"""
8290
Return the absolute path from the git repository root
@@ -300,6 +308,8 @@ def auth_login(self, args):
300308
password = getpass('password: ')
301309
url = urlparse.urljoin(controller, '/api/auth/login/')
302310
payload = {'username': username, 'password': password}
311+
# clear any cookies for this controller's domain
312+
self._session.clear(urlparse.urlparse(url).netloc)
303313
# prime cookies for login
304314
self._session.get(url, headers=headers)
305315
# post credentials to the login URL

0 commit comments

Comments
 (0)