Beispiel #1
0
def registration():
    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')
        hashed_password = data_manager.hash_password(password)
        data_manager.add_new_user(username, hashed_password)
        return redirect(url_for('index'))
    return render_template('registration.html')
Beispiel #2
0
def register():
    if request.method == 'POST':
        username = request.form['username']
        password = data_manager.hash_password(request.form['password'])
        email = request.form['email']
        data_manager.add_user(username, password, email)
        return redirect('/login')

    return render_template('register.html')
def hash_password():
    if request.method == 'POST':
        password = request.form['password']
        hashed_password = data_manager.hash_password(password)
        background_color = '#1976d2'
        return render_template('home.html',
                               background_color=background_color,
                               password=password,
                               hashed=hashed_password)
Beispiel #4
0
def registration():
    if request.method == "POST":
        username = request.form['username']
        password = data_manager.hash_password(request.form['password'])
        try:
            sql.register_user(username, password)
            return json.dumps({'status': url_for("index")})
        except:
            return json.dumps({'status': 'FAILED'})
    return render_template("registration.html")
Beispiel #5
0
def route_register():
    username = request.form.get("username")
    try:
        password = request.form.get("password")
        hashed_pw = dm.hash_password(password)
        dm.register_user(username, hashed_pw)
        return redirect(url_for('route_list'))
    except psycopg2.IntegrityError:
        error_message = "Username already exists, please choose another one!"
        return render_template('register.html', error=error_message)
def registration():
    if request.method == 'POST':
        user_name = request.form['user_name']
        password = request.form['password']
        verify_password = request.form['verify_password']
        if password == verify_password:
            pwd_hash = data_manager.hash_password(password)
            data_manager.insert_new_user(user_name, pwd_hash)
            return redirect(url_for('index'))
    return render_template('registration_form.html')
Beispiel #7
0
def registration():
    if request.method == 'POST':
        user = data_manager.user_checking(request.form['username'])
        if len(user) == 0:
            password = data_manager.hash_password(request.form['password'])
            login_name = request.form['username']
            data_manager.registration(login_name, password)
            return redirect(url_for('index', already_used=False))
        else:
            return redirect(url_for('registration', already_used=True))
    return render_template('registration.html', already_used=False)
Beispiel #8
0
def registration():
    error = None
    if request.method == 'POST':
        if not data_manager.users(request.form['user_name'])[0]['case'] == 0:
            error = 'E-mail address already in use!'
            return render_template("registration.html", error=error)
        data_manager.add_user(
            request.form['user_name'],
            data_manager.hash_password(request.form['password']))
        return redirect(url_for('index'))
    return render_template("registration.html", error=error)
Beispiel #9
0
def register():
    if request.method == 'GET':
        return render_template('register.html')
    elif request.method == 'POST':
        name = request.form['name']
        username = request.form['username']
        email = request.form['email']
        cars = request.form['cars']
        # salt = data_manager.get_salt() -- as bcrypt saves it automatically in the hash
        password = data_manager.hash_password(request.form['password'])
        data_manager.register_user(name, username, email, cars, password)
        return redirect(url_for('index'))
Beispiel #10
0
def registration():
    if request.method == 'POST':
        new_user = request.form.to_dict()
        new_user['password'] = data_manager.hash_password(new_user['password'])
        try:
            DB_queries.save_registration(new_user)
            return redirect(url_for('main_page'))
        except IntegrityError:
            return render_template(
                'registration.html',
                message="Username or email is already in use")
    return render_template('registration.html')
Beispiel #11
0
def register():
    if request.method == 'POST':
        user = data_manager.check_user(request.form['register_user_name'])
        if len(user) == 0:

            password = data_manager.hash_password(
                request.form['register_password'])

            login_name = request.form['register_user_name']
            print("registered")
            data_manager.register(login_name, password)

            return redirect(url_for('planets_first_page', already_used=False))
        else:
            return redirect(url_for('register', already_used=True))
    return render_template('registration.html', already_used=False)
Beispiel #12
0
def register():
    if request.method == 'POST':
        print('POST request received!')
        username = request.form['username']
        password = data_manager.hash_password(request.form['password'])
        if request.form.get('profile_picture'):
            profile_picture = request.form.get('profile_picture')
        else:
            profile_picture = 'http://icreatived.com/wp-content/uploads/2014/10/Interesting-Creative-Facebook-Profile-Picture-Ideas-5.jpg'
        try:
            connection.register_user(username, password, profile_picture)
        except:
            pass
        return redirect(url_for('route_list'))
    else:
        return render_template('register.html',
                               colour=data_manager.get_style(
                                   session.get('username')))
def register():
    if request.method == 'GET':
        return render_template('registration.html')
    if request.method == 'POST':
        username = request.form.get('username')
        email = request.form.get('email')
        plain_text_password = request.form.get('password')
        repeat_password = request.form.get('password-repeat')
        hashed_pw = data_manager.hash_password(plain_text_password)
        verified_pw = data_manager.verify_password(repeat_password, hashed_pw)
        if verified_pw:
            success_state = data_manager.register(username, email, hashed_pw)
            if success_state:
                return redirect('/')
            else:
                success = False
                return render_template('registration.html', success=success)
        else:
            verified = False
            return render_template('registration.html', verified=verified)
def registration():
    if request.method == 'GET':
        return render_template("registration.html")
    else:
        name = request.form['name']
        email = request.form['email']
        every_username = data_manager.check_name_in_database(name)
        every_email = data_manager.check_email_in_database(email)

        if every_username is None and every_email is None:
            image = request.form['image']
            password = request.form['password']
            email = request.form['email']
            hashed_password = data_manager.hash_password(password)
            if len(image) < 5:
                data_manager.save_registration_without_image(name, hashed_password, email)
                return render_template("main.html")
            else:
                data_manager.save_registration(name, hashed_password, image, email)
                return render_template("main.html")
        else:
            return render_template('message.html', message='Username or e-mail is already taken', url=url_for('registration'))