コード例 #1
0
def main():
	click.secho('--Docker as a Service--', fg='red', bg='white',blink = True)
	try:
		config_file = open('config.json', 'r')
	except:
		click.secho("Configuration file doesn't exists.", fg='red')

	try:
		data = json.load(config_file)
		url = data['url']
		if(("url" not in data) or data['url']==""):
			raise ValueError

		if(("username" in data) and data['username']!=""):
			login_result = login(url, data['username'])
		else:
			questions = [
			  	inquirer.List('size',
					message="Choose",
					choices=['LOGIN', 'REGISTER'],
				),
			]
			answer = inquirer.prompt(questions)
			if(answer['size']=='LOGIN'):
				login_result = login(url)
			else:
				register(url)
				login_result = login(url)

		authToken = login_result['token']
		operate(authToken, data)

	except Exception as e:
		click.secho(e, fg='red')    
コード例 #2
0
def create_app():
    app = flask.Flask(__name__, instance_relative_config=True)
    app.config.update(default_config)
    app.config.from_pyfile("settings.py", silent=True)

    app.jinja_options = app.jinja_options.copy()
    app.jinja_options['extensions'] += ['jinja2.ext.i18n', 'jinja2.ext.do']

    template_loader = app.create_global_jinja_loader()
    if app.config["ZOPE_TEMPLATE_PATH"]:
        from naturasites.loader import ZopeTemplateLoader
        template_loader = ZopeTemplateLoader(template_loader,
                                             app.config["ZOPE_TEMPLATE_PATH"],
                                             app.config["ZOPE_TEMPLATE_CACHE"],
                                             app.config["ZOPE_TEMPLATE_LIST"])
    app.jinja_options['loader'] = template_loader

    if 'STATIC_URL_MAP' in app.config:
        from werkzeug.wsgi import SharedDataMiddleware
        app.wsgi_app = SharedDataMiddleware(app.wsgi_app,
                                            app.config['STATIC_URL_MAP'])

    naturasites.views.register(app)
    tinygis.views.register(app)
    auth.register(app)

    app.jinja_env.install_gettext_translations(translations)

    return app
コード例 #3
0
ファイル: manage.py プロジェクト: eaudeweb/natura2000db
def create_app():
    app = flask.Flask(__name__, instance_relative_config=True)
    app.config.update(default_config)
    app.config.from_pyfile("settings.py", silent=True)

    app.jinja_options = app.jinja_options.copy()
    app.jinja_options['extensions'] += ['jinja2.ext.i18n', 'jinja2.ext.do']

    template_loader = app.create_global_jinja_loader()
    if app.config["ZOPE_TEMPLATE_PATH"]:
        from naturasites.loader import ZopeTemplateLoader
        template_loader = ZopeTemplateLoader(template_loader,
                                             app.config["ZOPE_TEMPLATE_PATH"],
                                             app.config["ZOPE_TEMPLATE_CACHE"],
                                             app.config["ZOPE_TEMPLATE_LIST"])
    app.jinja_options['loader'] = template_loader

    if 'STATIC_URL_MAP' in app.config:
        from werkzeug.wsgi import SharedDataMiddleware
        app.wsgi_app = SharedDataMiddleware(app.wsgi_app,
                                            app.config['STATIC_URL_MAP'])

    naturasites.views.register(app)
    tinygis.views.register(app)
    auth.register(app)

    app.jinja_env.install_gettext_translations(translations)

    return app
コード例 #4
0
def main():
    try:
        print('Thank you for choosing our high-quality Product!')
        user_type_input = input('''Have you already registered?
        Please type Yes (Y) or No (N) ''').lower().strip()
        if user_type_input == 'yes' or user_type_input == 'y':
            print('Authorization')
            authorization()
        elif user_type_input == 'no' or user_type_input == 'n':
            user_second_answer = input(
                'Would you like to register? Please type Yes (Y) or No (N)')
            if user_second_answer == 'y' or user_second_answer == 'yes':
                print('Registering')
                register()
            elif user_second_answer == 'no' or user_second_answer == 'n':
                print('BASIC CALCULATION VERSION')
                simple_operations()
            else:
                print('Not correct input. Have a nice day! Bye!')
        else:
            print('Not correct input. Please try again')
            input('Would you try again? Type Yes or No'.lower().strip())
            if user_type_input == 'yes' or user_type_input == 'y':
                main()
            else:
                print('Have a nice day! Bye!')
    except Exception as e:
        print(Exception)
コード例 #5
0
def admin_role(admin):
    login = True
    while(login):
        choice = admin_prompt()
        if choice == 0:
            register()
        elif choice == 1:
            login = False
        elif choice == 2:
            exit()
コード例 #6
0
def main():
    conn = connection.connect()
    print("Welcome to Look Inna Bookstore")
    print("Note: In order to be able to checkout, you will first need to register.")

    login_obj = None
    option = ""
    while option != "exit":
        print("")
        if(login_obj):
            print("You are currently signed in as", login_obj["username"])
        print("Please select from one of the following options:")
        print("shop")
        print("view checkout cart")
        if(login_obj):
            print("checkout")
            print("order lookup")
            print("logout")
            if(login_obj["acc_type"] == "owner" or login_obj["acc_type"] == "admin"):
                print("manage publishers")
                print("manage authors")
                print("manage books")
                print("manage genres")
                if(login_obj["acc_type"] == "owner"):
                    print("manage users")
                    print("view report")
        else:
            print("login")
            print("register")
        print("exit")

        option = input("> ")

        if (option == "login"):
            login_obj = auth.login(conn)
        elif (option == "register"):
            auth.register(conn)
        elif(option == "logout"):
            login_obj = None
        elif(login_obj):
            if(option == "manage publishers" and (login_obj["acc_type"] == "owner" or login_obj["acc_type"] == "admin")):
                publishers.menu(conn)
            elif(option == "manage genres" and (login_obj["acc_type"] == "owner" or login_obj["acc_type"] == "admin")):
                genres.menu(conn)
            elif(option == "manage books" and (login_obj["acc_type"] == "owner" or login_obj["acc_type"] == "admin")):
                books.menu(conn)
            elif(option == "manage authors" and (login_obj["acc_type"] == "owner" or login_obj["acc_type"] == "admin")):
                authors.menu(conn)
            elif(option == "manage users" and login_obj["acc_type"] == "owner"):
                users.menu(conn)

    conn.close()
コード例 #7
0
def test_invalid_email_reg():
    '''
    Test auth.register on an invalid email
    '''
    workspace_reset()
    payload = {
        'email' : 'Kennan@com',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }
    with pytest.raises(InputError):
        auth.register(payload)
コード例 #8
0
ファイル: app.py プロジェクト: Siimon13/NYUDaily
def register():
	if request.method == "GET":
		return render_template('register.html')
	else:
		username = request.form['username'].encode('ascii','ignore')
		password = request.form['password'].encode('ascii','ignore')
                print username
                print password
		if auth.register(username,password):
                        print "Auth.register worked!"
			return redirect('/login')
		else:
			return render_template('register.html',message= auth.register(username,password))
コード例 #9
0
def test_short_name():
    '''
    Test auth.register on a short first name
    '''
    workspace_reset()
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'K',
        'name_last': 'Wong'
    }
    with pytest.raises(InputError):
        auth.register(payload)
コード例 #10
0
def prompt_auth_choices():
    print("Please select your choice: ")
    print("\t" * 2, "1- Register")
    print("\t" * 2, "2- login")
    choice = input("")
    if choice.isdigit() and int(choice) in [1, 2]:
        if int(choice) == 1:
            auth.register(users_file_path)
            prompt_auth_choices()
        elif int(choice) == 2:
            prompt_login()
    else:
        print("\n" * 3)
        print("Enter valid choice!")
        prompt_auth_choices()
コード例 #11
0
ファイル: helpers.py プロジェクト: steve-jang/Meeter
def create_bot():
    """
    Create a new user for testing.

        Returns:
            User object
    """
    global UNIQUE_ID
    username = BOT_USERNAME + str(UNIQUE_ID)
    UNIQUE_ID += 1

    register(username, BOT_PASSWORD, BOT_FIRST_NAME, BOT_LAST_NAME,
             username + "@gmail.com")

    return data.users.get(username)
コード例 #12
0
def init():
    print("Welcome to bankPHP")

    account_holder = int(
        input("Do you have an account with us: 1 (yes) 2 (no) \n"))

    if account_holder == 1:
        auth.login()

    elif account_holder == 2:
        auth.register()

    else:
        print("You have selected an invalid option. Please try again.")
        init()
コード例 #13
0
def test_register_double1():
    '''
    Test if a user tries to re register
    '''
    workspace_reset()
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }
    auth.register(payload)

    with pytest.raises(InputError):
        auth.register(payload)
コード例 #14
0
ファイル: app.py プロジェクト: aqueed-shaikh/submissions
def register():
    if request.method == "GET":
        return render_template("register.html")
    else:
        username = request.form['username']
        password = request.form['password']
        confirmpassword = request.form['confirmpassword'].encode(
            "ascii", "ignore")
        security = request.form['security']
        answer = request.form['answer']
        button = request.form['button']
        if button == "Submit":
            #if accounts.has_key(username):
            # return render_template("register.html", message = "There is already an account under your name.")
            if (username == '' or password == '' or confirmpassword == ''
                    or answer == ''):
                return render_template("register.html",
                                       message="Please fill empty fields")
            elif password != confirmpassword:
                return render_template(
                    "register.html",
                    message="Please enter the same passwords.")
            else:
                if (auth.register(username, password, security, answer)):
                    session["name"] = username
                    return redirect("/members")
                else:
                    return render_template(
                        "register.html",
                        message="There is already an account under your name.")
        elif button == "Cancel":
            return render_template("register.html")
コード例 #15
0
ファイル: run.py プロジェクト: Eakz/WebAcademy_homework
def login_menu_choice():  # sequence for starting menu
    login_count = 3
    active_user = None
    print(
        'Calculator.Simple.\n1. Register\n2. Log in(existing user)\n3.Fast calculations\t\t\t\t\t'
        'At any time type "quit" to quit')
    while True:
        try:
            menu = float(quit_filter(input('>>> ')))
            break
        except Exception as e:
            print(f'{e} Please re-enter')

    while True:
        if active_user:
            print(f'Logged in as {active_user.login}')
            break
        if login_count <= 3 and active_user == None:
            print(f'{login_count} attempts to log in left...\n\n\n{"*" * 40}')
        if login_count <= 0:
            menu = 3

        if menu == 1:
            while True:
                try:
                    print('Create new user')
                    init_db()
                    user = register()
                    if user:
                        active_user = User(login=user['login'],
                                           password=user['password'],
                                           id=user['id'],
                                           log=user['log'])
                    else:
                        active_user = anon
                    break
                except Exception as e:
                    print(f'{e}, dude come on, its not that hard! ◕_◕')

        elif menu == 2:
            while True:
                try:
                    login, password = login_input()
                    break
                except Exception as e:
                    print(e)

            for user in Database.read_users('pipi'):
                if user['login'] == login and user['password'] == password:
                    print(f'logging in as {user["login"]}')
                    active_user = User(user['login'], user['password'],
                                       user['log'], user['id'])
                    break
            else:
                login_count -= 1
        elif (menu != 1 and menu != 2):
            print('Welcome my dear Anonymous')
            active_user = anon
            print(active_user)
    return active_user
コード例 #16
0
ファイル: app.py プロジェクト: dtang1/softdev
def register():
    if request.method == "GET" :
        return render_template("register.html")
    else:
        username = request.form['username']
        password = request.form['password']
        confirmpassword = request.form['confirmpassword'].encode("ascii","ignore")
        security = request.form['security']
        answer = request.form['answer']
        button = request.form['button']
        if button == "Submit":
            #if accounts.has_key(username):
               # return render_template("register.html", message = "There is already an account under your name.")
            if (username == '' or password == '' or confirmpassword == '' or answer == ''):
                return render_template("register.html", message = "Please fill empty fields")
            elif password != confirmpassword:
                return render_template("register.html", message = "Please enter the same passwords.")
            else:
                if(auth.register(username,password,security,answer)):
                    session["name"] = username    
                    return redirect("/members")
                else:
                    return render_template("register.html", message = "There is already an account under your name.")
        elif button == "Cancel":
            return render_template("register.html")
コード例 #17
0
def reg_user1():
    'registers first user'
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }
    user1 = auth.register(payload)
    return user1
コード例 #18
0
def reg_user2():
    'registers second user'
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Cindy',
        'name_last': 'Tran'
    }
    user2 = auth.register(payload)
    return user2
コード例 #19
0
ファイル: register_test.py プロジェクト: steve-jang/Meeter
def test_success_register():
    """
    Test a successful registration.
    """
    assert not register("abc123", "qwerty123456", "Bob", "John", "*****@*****.**")

    # Check that user data was updated and that the user is logged in
    new_user = data.users.get("abc123")
    assert new_user
    assert new_user.logged_in == True
コード例 #20
0
def reg_user3():
    'registers third user'
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Thomas',
        'name_last': 'Shelby'
    }
    user3 = auth.register(payload)
    return user3
コード例 #21
0
def test_login():
	results1 = register('*****@*****.**', 'hayden123', 'hayden', 'smith')
	u_id = results1['u_id']
	token = results1['token']

	result2 = login('*****@*****.**', 'hayden123')
	u_id2 = results2['u_id']
	token2 = results['token']

	assert u_id1 == u_id2
コード例 #22
0
 def register(self, username, password):
     if auth.register(username, password):
         try:
             os.makedirs(os.path.abspath(ROOTDIR + "/" + username+ "/"))
             auth.add_file(os.path.abspath(ROOTDIR + '/' + username + '/'), username)
         except OSError as exc:
             return False
         return 'ok'
     else:
         return 'fail'
コード例 #23
0
ファイル: application.py プロジェクト: gonghao/cloudstore
def register():
    if request.method == 'GET':
        return render_template('register.html')

    if request.method == 'POST':
        user = auth.register(request.form)
        if isinstance(user, auth.User):
            session['user'] = user
            return redirect(url_for('index'))
        else:
            return render_template('register.html', errors=user)
コード例 #24
0
def register():
    if request.method == "GET":
        return render_template("register.html")
    else:
        username = request.form["username"]
        password = request.form["password"]
        if auth.register(username,password):
            session['username'] = username
            return redirect(url_for('home'))
        else:
            return render_template("register.html") #return specific error?
コード例 #25
0
def register():
    req = request.get_json()
    username = req['username'].lower()
    password = req['password']
    email = req['email']
    interests = req['interests']
    msg_string = auth.register(email, username, password, interests)
    if(msg_string[0] == 'P'):
        msg = Message(subject="Verify your email", sender=app.config.get("MAIL_USERNAME"), recipients=[email], body=msg_string)
        mail.send(msg)
        return "DONE"
    return msg_string
コード例 #26
0
 def addRegistration(self, ukey, username, password,
                     display_name, pub_key,
                     credential_id, sign_count,
                     rp_id, icon_url):
     token = auth.register(ukey, username, password,
                           display_name, pub_key,
                           credential_id, sign_count,
                           rp_id, icon_url)
     if token is not None:
         return self.loginCookie(username, token)
     else:
         return None
コード例 #27
0
def test_email_used():
    '''
    Test register on an email which has already
    been used to register a user
    '''
    workspace_reset()
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }
    auth.register(payload)

    payload2 = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Ken',
        'name_last': 'Wong'
    }
    with pytest.raises(InputError):
        auth.register(payload2)
コード例 #28
0
ファイル: app.py プロジェクト: christi1001dx/proj1-7
def register():
    if request.method == "GET":
        return render_template("register.html", message = "")
    else:
        button = request.form['button'].encode("utf8")
        if button == "Submit":
            if auth.register(request.form['user'], request.form['pass']):
                session['user'] = request.form['user']
                return redirect(url_for('home'))
            else:
                return render_template("register.html", message = "User already exists. Please login.")
        else:
            return render_template("register.html", message = "")    
コード例 #29
0
def register():
	if 'user' in session:
		return redirect(url_for('home'))
	elif request.method == "GET":
		return render_template("register.html",em="")
	elif request.method == "POST":
		name = request.form['name']
		user = request.form['user']
		pw = request.form['pw']
		detail = request.form['detail']
		if (auth.register(user,pw,name,detail)):
			session['user'] = user
			return redirect(url_for('home'))
		else:
			return render_template('register.html',em="username already registered!")
コード例 #30
0
ファイル: app.py プロジェクト: gitgik/Bucket-list-app-API
 def register():
     """Handle user registration, ensuring only a POST request registers"""
     if request.method == 'GET':
         return {
             'message': 'Welcome to the BucketList service',
             'more': 'To Register, please make a POST /auth/register with \
                 username and password'
         }, 200
     else:
         username = request.form.get('username')
         password = request.form.get('password')
         if username and password:
             return auth.register(username, password)
         else:
             raise ParseError()
コード例 #31
0
def register():
    # type:
    # 1 = username already in use
    # 2 = passwords don't match
    if request.method == "POST":
        if request.form["password"] == request.form["password2"]:
            result = auth.register(request.form["username"],request.form["password"])
            if result:
                session["uid"] = result
                return redirect("/?type=2")
            else:
                return page(html.register(1),-1)
        else:
            return page(html.register(2),-1)
    else:
        return page(html.register(0),-1)
コード例 #32
0
ファイル: hangman.py プロジェクト: KennanWong/The_Slakrs
def get_hangman():
    '''
    Function to get the hangman details, otherwise we need to register the hangman
    '''
    hangman = get_user_from('name_first', 'Hangman')
    if hangman is None:
        # if we get returned an empty dictionary register hangman
        print('if we get returned an empty dictionary register hangman')
        payload = {
            'email': '*****@*****.**',
            'password': '******',
            'name_first': 'Hangman',
            'name_last': 'Bot'
        }
        hangman = auth.register(payload)
    return hangman
コード例 #33
0
ファイル: app.py プロジェクト: ChanYvonne/animal-Adoption
def authenticate():
    un = request.form["handle"]

    if request.form["type"] == "register":
        ps1 = request.form["pass1"]
        ps2 = request.form["pass2"]
        regRet = auth.register(un, ps1, ps2)  #returns an error/success message
        return render_template("account.html", regerror=regRet)

    else:
        pw = request.form["pass"]
        text = auth.login(un, pw)  #error message
        if text == "":  #if no error message, succesful go back home
            session["username"] = un
            print text
            return redirect(url_for('home'))
        return render_template("account.html", logerror=text)
コード例 #34
0
def register():
    if 'user' in session:
        return redirect(url_for('home'))
    elif request.method == "GET":
        return render_template("register.html", message="")
    else:
        button = request.form['button'].encode("utf8")
        if button == "Register":
            if auth.register(request.form['user'], request.form['pass']):
                session['user'] = request.form['user']
                return redirect(url_for('home'))
            else:
                return render_template(
                    "register.html",
                    message="User already exists. Please login.")
        else:
            return render_template("register.html", message="")
コード例 #35
0
def test_register1():
    '''
    Test valid use of test_register
    '''
    workspace_reset()
    payload = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }

    result1 = auth.register(payload)

    auth_store = get_auth_data_store()

    assert result1 in auth_store
コード例 #36
0
def register():
    if request.method == "GET" :
        return render_template("register.html",message = "Please register")
    else:
        username = request.form['username']
        password = request.form['password']
        confirmpassword = request.form['confirmpassword']
        if (username == '' or password == '' or confirmpassword == ''):
            return render_template("register.html", message = "Please fill empty fields")
        elif password != confirmpassword:
            return render_template("register.html", message = "Please enter the same passwords.")
        elif (auth.checkuser(username) == True):
            return render_template("register.html", message = "Username already taken. Please choose another username.")
        else:
            if(auth.register(username,password)):
                session["name"] = username    
                return redirect("/storylist")
            else:
                return render_template("register.html", message = "There is already an account under your name.")
コード例 #37
0
def register_and_create():
    'registers first user and creates a chanenl'
    payload1 = {
        'email' : '*****@*****.**',
        'password': '******',
        'name_first': 'Kennan',
        'name_last': 'Wong'
    }
    result1 = auth.register(payload1)

    payload2 = {
        'token' : result1['token'],
        'name': 'firstChannel',
        'is_public': True
    }
    new_channel = channels.create(payload2)
    return {
        'user':result1,
        'channel':new_channel
    }
コード例 #38
0
ファイル: app.py プロジェクト: osule/bucket-list-api
 def register():
     '''Responds to /auth/register (GET request) by returning
      a JSON response containing instructions.
     It also returns a success message for a POST request to register a
      new user.
     '''
     if request.method == "GET":
         return {
             "message":
             "Welcome to the bucketlist service",
             "more":
             "To register make a POST request to /register ENDPOINT\
             with [username] and [password]"
         }, 200
     else:
         username = request.form.get("username")
         password = request.form.get("password")
         if username and password:
             return auth.register(username, password)
         else:
             raise ParseError()
コード例 #39
0
ファイル: app.py プロジェクト: ServePeak/proj3-6-JJTS
def register():
    if request.method == 'GET':
        return render_template('register.html')
    else:
        username = request.form['username'].encode('ascii', 'ignore')
        password = request.form['password'].encode('ascii', 'ignore')
        checkpas = request.form['checkpas'].encode('ascii', 'ignore')
        email = request.form['email'].encode('ascii', 'ignore')
        if auth.register(username,password,checkpas,email) == 'True':
            return render_template('home.html')
        if auth.register(username,password,checkpas,email) == 'There is a account with that username':
            error1 = auth.register(username, password,checkpas,email)
            return render_template('register.html', error1 = error1)
        if auth.register(username,password,checkpas,email) == "Passwords aren't the same":
            error2 = auth.register(username, password,checkpas,email)
            return render_template('register.html', error2 = error2)
        if auth.register(username,password,checkpas,email) == "There is an account with that email":
            error3 = auth.register(username, password,checkpas,email)
            return render_template('register.html', error3 = error3)
コード例 #40
0
def registersite():
	if request.method == 'POST':
		form = request.form.get
		
		code = auth.register(form('uname'), form('pass'), form('email'))
		login = (form('email'), form('uname'), form('pass'))
		if code == 0:
			return "User created!<br><a href='/login'>Click here to go back</a>"
		elif code == 1:
			return render_template("register.html", criteria=True, login=login)
		elif code == 2:
			return render_template("register.html", error="Username already exists.", login=login)
		elif code == 3:
			return render_template("register.html", error="Email already exists.", login=login)
		elif code == 4:
			return render_template("register.html", error="Username is too short! It has to be at least 5 characters long", login=login)
		elif code == 5:
			return render_template("register.html", error="Invalid email address!", login=login)
		else:
			return "Unknown Error"

	return render_template("register.html")
コード例 #41
0
ファイル: main.py プロジェクト: STALKER2010/ProjectTracker
def register(env, headers):
    post_data = _get_post_data(env)
    if ('password' in post_data) and ('username' in post_data):
        password = post_data['password'][0]
        username = post_data['username'][0]
        if auth.register(username, password) is None:
            error_msg = urllib.parse.quote('Registration failed')

            err_msg = "Guest tried to register '{}' and failed"
            err_msg = err_msg.format(str(username))
            common.dbg_log(err_msg)

            location = '/?error_msg={}'.format(error_msg)
            headers.append(('Location', location))
        else:
            auth.login(username, password, headers)
            headers.append(('Location', '/dashboard'))
    else:
        error_msg = urllib.parse.quote('Username or password is not given')
        location = '/?error_msg={}'.format(error_msg)
        headers.append(('Location', location))
    return ''
コード例 #42
0
ファイル: app.py プロジェクト: andela-osule/bucket-list-api
 def register():
     """Responds to /auth/register (GET request) by returning
      a JSON response containing instructions.
     It also returns a success message for a POST request to register a
      new user.
     """
     if request.method == "GET":
         return (
             {
                 "message": "Welcome to the bucketlist service",
                 "more": "To register make a POST request to /register ENDPOINT\
             with [username] and [password]",
             },
             200,
         )
     else:
         username = request.form.get("username")
         password = request.form.get("password")
         if username and password:
             return auth.register(username, password)
         else:
             raise ParseError()
コード例 #43
0
def register():
    error = None
    if request.method == "GET":
        return render_template("register.html")
    else:
        username = request.form["username"]
        password = request.form["password"]
        cpassword = request.form["cpassword"]
        
        if (request.form["username"]=="" or request.form["password"]==""):
            return render_template("register.html",error="empty")
        elif (request.form["cpassword"]==""):
            return render_template("register.html",error="badc")
        elif (request.form["username"]==request.form["password"]):
            return render_template("register.html",error="lazy")
        elif request.form["password"]!=request.form["cpassword"]:
            return render_template("register.html",error="wrongc")

        if auth.register(username, password):
            session['username'] = username
            return redirect(url_for('login'))
        else:
            return redirect(url_for('index'))
コード例 #44
0
ファイル: app.py プロジェクト: christi1001dx/proj1-7
def register():
    if 'username' in session:
        return redirect(url_for('home'))
    datum = iden()
    if request.method == 'GET':
        return render_template('Register.html',data=datum)
    if request.method == "POST":
        fname = request.form['Firstname']
        lname = request.form['Lastname']
        name = request.form['username']
        pw = request.form['pw']
        pw2 = request.form['pw2']
        if pw != pw2:
            m = "passwords to not match, please try again."
            return render_template("Register.html",data=datum,m=m)
        if auth.register(fname,lname,name,pw):
            global _loggedin
            _loggedin = True
            session["username"]= name
            return redirect(url_for('home'))
        else:
            m = "username already registered. Try a differnt one"
            return render_template("Register.html",data=datum,m=m)
        return redirect(url_for('home'))
コード例 #45
0
ファイル: auth-server.py プロジェクト: adataylor/checkbits
 def rpc_register(self, username, password):
     return auth.register(username, password)
コード例 #46
0
 def addRegistration(self, username, password):
     token = auth.register(username, password)
     if token is not None:
         return self.loginCookie(username, token)
     else:
         return None
コード例 #47
0
ファイル: auth-server.py プロジェクト: chaser3/lab628
 def rpc_register(self, uname, pword):
     return auth.register(uname, pword)