Example #1
0
 def add_user():
     email    = click.prompt('Email?', type = str)
     password = click.prompt('Password?', type = str, hide_input = True, confirmation_prompt = True)
     r = user_datastore.find_or_create_role("admin")
     u = user_datastore.create_user(email = email, password = password)
     if click.confirm("Admin User?"):
         user_datastore.add_role_to_user(u, "admin")
     else:
         click.echo("Regular User.")
Example #2
0
 def add_user():
     email = click.prompt('Email?', type=str)
     password = click.prompt('Password?',
                             type=str,
                             hide_input=True,
                             confirmation_prompt=True)
     r = user_datastore.find_or_create_role("admin")
     u = user_datastore.create_user(email=email, password=password)
     if click.confirm("Admin User?"):
         user_datastore.add_role_to_user(u, "admin")
     else:
         click.echo("Regular User.")
Example #3
0
    def register_new_user(**kwargs):
        from survaider.security.controller import user_datastore

        reg_dat = get_connection_values_from_oauth_response(kwargs['provider'], kwargs['oauth_response'])

        user = user_datastore.create_user(email = reg_dat['email'], password = str(uuid.uuid4()))
        user.metadata['full_name'] = reg_dat['full_name'] if 'full_name' in reg_dat else reg_dat['display_name'] if 'display_name' in reg_dat else None

        user.save()

        reg_dat['user_id'] = str(user)
        connect_handler(reg_dat, kwargs['provider'])
        login_user(user)

        return True
Example #4
0
    def register_new_user(**kwargs):
        from survaider.security.controller import user_datastore

        reg_dat = get_connection_values_from_oauth_response(
            kwargs['provider'], kwargs['oauth_response'])

        user = user_datastore.create_user(email=reg_dat['email'],
                                          password=str(uuid.uuid4()))
        user.metadata['full_name'] = reg_dat[
            'full_name'] if 'full_name' in reg_dat else reg_dat[
                'display_name'] if 'display_name' in reg_dat else None

        user.save()

        reg_dat['user_id'] = str(user)
        connect_handler(reg_dat, kwargs['provider'])
        login_user(user)

        return True