summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Schäffer <leonardo.schaffer@gmail.com>2015-07-05 18:40:45 -0300
committerLeonardo Schäffer <leonardo.schaffer@gmail.com>2015-07-05 18:40:45 -0300
commitb228de6c5ef8cbf772f7d05d9e851acc96fb58a0 (patch)
tree9cc716ff62a212859e7a70712ff2f6747ffada59
parente07a76471291256094028f0a29e4f278baa83cf6 (diff)
parentf02ab41fd3b9a329f8b9911f43b39c47485cd4bb (diff)
Merge branch 'master' into floatlabel_for_compose
-rw-r--r--service/pixelated/config/arguments.py1
-rw-r--r--service/pixelated/register.py7
2 files changed, 7 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..97f19d2e 100644
--- a/service/pixelated/register.py
+++ b/service/pixelated/register.py
@@ -24,6 +24,8 @@ 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 +33,7 @@ logger = logging.getLogger(__name__)
def register(
server_name,
username,
+ password,
leap_home,
provider_cert,
provider_cert_fingerprint):
@@ -40,7 +43,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 +70,7 @@ def initialize():
register(
args.provider,
args.username,
+ args.password,
args.leap_home,
args.leap_provider_cert,
args.leap_provider_cert_fingerprint)