from mediagoblin.auth import lib as auth_lib
from mediagoblin import mg_globals
-
def adduser_parser_setup(subparser):
subparser.add_argument(
'--username','-u',
#TODO: Lets trust admins this do not validate Emails :)
commands_util.setup_app(args)
+ args.username = commands_util.prompt_if_not_set(args.username, "Username:")
+ args.password = commands_util.prompt_if_not_set(args.password, "Password:",True)
+ args.email = commands_util.prompt_if_not_set(args.email, "Email:")
+
db = mg_globals.database
users_with_username = \
db.User.find({
from mediagoblin import app
+import getpass
def setup_app(args):
mgoblin_app = app.MediaGoblinApp(args.conf_file)
return mgoblin_app
+
+def prompt_if_not_set(variable,text,password=False):
+ """
+ Checks if the variable is None and prompt for a value if it is
+ """
+ if (variable==None):
+ if not password:
+ variable=raw_input(text+' ')
+ else:
+ variable=getpass.getpass(text)
+
+ return variable