def register_user(user_name, password, e_mail, country, city, avatar_image): if db.email_exists(e_mail): return jsonify({"response": ["E-Mail Already Registered"]}) elif db.user_name_exists(user_name): return jsonify({"response": ["User Name Taken"]}) else: db.add_new_user(user_name, password, e_mail, country, city, avatar_image) return jsonify({"response": ["Success"]})
def update_user_data(original_user_name, original_e_mail, new_user_name, new_e_mail, new_password, new_country, new_city, new_location, new_image): response = "Success" if original_user_name != new_user_name and db.user_name_exists(new_user_name): response = "User Name Exists" elif original_e_mail != new_e_mail and db.email_exists(new_e_mail): response = "E-Mail Exists" else: db.update_user_data(original_user_name, new_user_name, new_e_mail, new_password, new_country, new_city, new_location, new_image) return jsonify({"response": [response]})
def update_user_data(original_user_name, original_e_mail, new_user_name, new_e_mail, new_password, new_country, new_city, new_location, new_image): response = "Success" if original_user_name != new_user_name and db.user_name_exists(new_user_name): response = "User Name Exists" elif original_e_mail != new_e_mail and db.email_exists(new_e_mail): response = "E-Mail Exists" else: db.update_user_data(original_user_name, new_user_name, new_e_mail, new_password, new_country, new_city, new_location, new_image) return {"response": response}