Skip to content

Commit

Permalink
error out on registration when we get an invalid user error message.
Browse files Browse the repository at this point in the history
Somehow the a bad username returns a 200 status code, so it's not enough
that we check for that.
  • Loading branch information
Aron Fyodor Asor committed Apr 7, 2015
1 parent f0bd27c commit 34a27be
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions python-packages/securesync/management/commands/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def handle(self, *args, **options):
csrftoken = s.cookies['csrftoken_central']
login_data = dict(username=options["username"], password=options["password"], csrfmiddlewaretoken=csrftoken, next='/')
r = s.post(login_url, data=login_data, headers={"Referer": login_url})
assert r.status_code == 200, "Error logging into central server: " + r.content
assert r.status_code == 200 and "Incorrect user" not in r.content, "Error logging into central server: " + r.content

# register on the central server
reg_url = client.get_registration_url()
Expand All @@ -80,5 +80,3 @@ def handle(self, *args, **options):
own_device = Device.get_own_device()
assert own_device.is_registered(), "Device was not registered successfully..."
sys.stdout.write("Device '%s' has been successfully registered to zone '%s'!\n" % (own_device.id, own_device.get_zone().id))


0 comments on commit 34a27be

Please sign in to comment.