diff options
author | Jefferson Stachelski <jeffhsta@riseup.net> | 2015-07-01 14:39:17 -0300 |
---|---|---|
committer | Jefferson Stachelski <jeffhsta@riseup.net> | 2015-07-01 14:39:17 -0300 |
commit | 068c3af36732fbc38318d076bf35e6844d9c3d0a (patch) | |
tree | 0cd0b06adc2df4dc37d0d2e8a3085ca8bf1376ce /service/pixelated | |
parent | 0b179c61043a9854fa23b8fd40fd252864ecd021 (diff) |
#346 Added a password parameter for script use
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/config/arguments.py | 1 | ||||
-rw-r--r-- | service/pixelated/register.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/service/pixelated/config/arguments.py b/service/pixelated/config/arguments.py index 56f83421..fa7fdae4 100644 --- a/service/pixelated/config/arguments.py +++ b/service/pixelated/config/arguments.py @@ -51,6 +51,7 @@ def parse_register_args(): parser = argparse.ArgumentParser(description='Pixelated register') parser.add_argument('provider', metavar='provider', action='store') parser.add_argument('username', metavar='username', action='store') + parser.add_argument('-p', '--password', metavar='password', action='store', default=None, help='used just to register account automatically by scripts') parser.add_argument('-lc', '--leap-provider-cert', metavar='<leap-provider.crt>', default=None, help='use specified file for LEAP provider cert authority certificate (url https://<LEAP-provider-domain>/ca.crt)') parser.add_argument('-lf', '--leap-provider-cert-fingerprint', metavar='<leap provider certificate fingerprint>', default=None, help='use specified fingerprint to validate connection with LEAP provider', dest='leap_provider_cert_fingerprint') parser.add_argument('--leap-home', help='The folder where the user agent stores its data. Defaults to ~/.leap', dest='leap_home', default=os.path.join(os.path.expanduser("~"), '.leap')) diff --git a/service/pixelated/register.py b/service/pixelated/register.py index f917840b..d99e97d7 100644 --- a/service/pixelated/register.py +++ b/service/pixelated/register.py @@ -24,6 +24,7 @@ from pixelated.bitmask_libraries.config import LeapConfig from pixelated.bitmask_libraries.provider import LeapProvider from pixelated.bitmask_libraries.session import LeapSessionFactory from leap.auth import SRPAuth +import pixelated.extensions.shared_db logger = logging.getLogger(__name__) @@ -31,6 +32,7 @@ logger = logging.getLogger(__name__) def register( server_name, username, + password, leap_home, provider_cert, provider_cert_fingerprint): @@ -40,7 +42,8 @@ def register( except ValueError: print('Only lowercase letters, digits, . - and _ allowed.') - password = getpass.getpass('Please enter password for %s: ' % username) + if not password: + password = getpass.getpass('Please enter password for %s: ' % username) LeapCertificate.set_cert_and_fingerprint(provider_cert, provider_cert_fingerprint) config = LeapConfig(leap_home=leap_home) @@ -66,6 +69,7 @@ def initialize(): register( args.provider, args.username, + args.password, args.leap_home, args.leap_provider_cert, args.leap_provider_cert_fingerprint) |