Beispiel #1
0
def sign_up():
    if not valid_request(request,
                         ['first_name', 'last_name', 'email', 'password']):
        return abort(400)

    first_name = request.form['first_name']
    last_name = request.form['last_name']
    email = request.form['email']
    password = request.form['password']

    salt = secrets.token_bytes(16)
    master_key = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), salt,
                                     100000)

    DB.create_user(first_name, last_name, email,
                   base64.b64encode(salt).decode('utf-8'),
                   base64.b64encode(master_key).decode('utf-8'))

    return redirect(f'{URL}/sign-in/sign-in.html', 303)
Beispiel #2
0
def start(context, bot):
    user_id = context.message.chat_id
    if not DB.check_user(user_id):
        DB.create_user(context.message)
    bot.bot.send_message(user_id, tx.get_text('start'))