server.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ecommercesiteComplete 作者: Daz4ever 项目源码 文件源码
def signUp():
    # Get data from sign up form on front-end (in JSON format)
    custEntry = request.get_json()
    entered_password = custEntry['password']
    entered_password2 = custEntry['password2']
    if entered_password == entered_password2:
        # Encrypt the password entered by the user
        salt = bcrypt.gensalt()
        encrypted_password = bcrypt.hashpw(entered_password.encode('utf-8'), salt)
        # Store the user information as a new entry (with the encrypted_password)
        result = db.insert('customer', username=custEntry['username'], email=custEntry['email'], password=encrypted_password, first_name=custEntry['first_name'], last_name=custEntry['last_name'])
        # Returns the user entered information
        return jsonify(result)
    else:
        # If passwords don't match
        return 'login failed', 401

# Allows a user to login to the site
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号