def test_profiles(): test_user = "******" + str(time.time()) p = storage.get_profile(test_user) assert p == None storage.add_profile({'user': test_user}) p = storage.get_profile(test_user) assert type(p) is dict assert 'user' in p assert p['user'] == test_user storage.delete_profile(test_user) p = storage.get_profile(test_user) assert p == None
def post_register(): salt = str(time.time())[3:] # save the registration to the profile database storage.add_profile({ 'user': request.form.get("user"), 'email': request.form.get("email"), 'salt': salt, 'password': encrypt(request.form.get("password"), salt) }) # if we are successful # -- PUT A CHECK HERE -- if True: response = make_response(redirect("/login")) response.set_cookie("message", "", expires=0) else: # else if we are not successful response = make_response(redirect("/register")) response.set_cookie("message", "Error in registration, please try again.") return response
def post_register(): #Creating salt shit salt = str(time.time())[3:] #function call that passes a dictionary. Dictionary contains user profile information storage.add_profile({ 'firstName': request.form.get("firstname"), 'lastName': request.form.get("lastname"), 'email': request.form.get("email"), 'phoneNumber': request.form.get("phonenumber"), 'salt': salt, 'password': encrypt(request.form.get("password"), salt) }) if True: #if she works response = make_response(redirect("/main")) else: #if she don't response = make_response(redirect("/register")) return response