def test_user_service_new_user(): clean_env() user_service = UserService(user_catalog, user_db) user_service.try_reg_user("admin", "admin") user = user_service.get_user("admin") assert user is not None clean_env()
def profile(): user = UserService.get_user(user_id=current_user.id) missing = UserService.get_missing_evaluations(user.id) if 'GET' == request.method: return render_template("profile.html", user=user, missing_evaluations=missing) data = dict(request.form) if data['password'][0] != user.password: return render_template("profile.html", user=user, error_message="Wrong password!") elif data['newPassword'][0] != data['confirmPassword'][0]: return render_template("profile.html", user=user, error_message="Non-matching password!") else: user.password = data['newPassword'][0] user = UserService.update_user(user) return render_template("profile.html", user=user, info_message="Information updated!")