diff options
author | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-24 17:26:12 +0200 |
---|---|---|
committer | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-24 17:26:20 +0200 |
commit | 21d8b0fd7f8cf7c40443a29e05de2f4b0062419d (patch) | |
tree | a4d9dc7aa386cfe4ec0aad29040f4721dbf04e78 | |
parent | 82f48843b3f723411777938b7e6777760e9463e5 (diff) |
Added error message when you try to register an username that already exists
-rw-r--r-- | service/pixelated/runserver.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/service/pixelated/runserver.py b/service/pixelated/runserver.py index bc624cc8..194c95c0 100644 --- a/service/pixelated/runserver.py +++ b/service/pixelated/runserver.py @@ -26,6 +26,7 @@ import pixelated.bitmask_libraries.register as leap_register import pixelated.config.reactor_manager as reactor_manager import pixelated.support.ext_protobuf # monkey patch for protobuf in OSX import pixelated.support.ext_sqlcipher # monkey patch for sqlcipher in debian +from pixelated.bitmask_libraries.leap_srp import LeapAuthException from twisted.internet import error @@ -46,8 +47,12 @@ def setup(): events_server.ensure_server(port=8090) if args.register: - server_name, username = args.register - leap_register.register_new_user(username, server_name) + try: + server_name, username = args.register + leap_register.register_new_user(username, server_name) + except LeapAuthException: + print('User already exists') + exit(1) else: if args.dispatcher: raise Exception('Dispatcher mode not implemented yet') |