def test_upload(): userID = request.form.get("userID") password = request.form.get("password") file = extract_photo_from_request() pwd_manager = Hash() if not pwd_manager.check_password(userID, password): return Response(status=401) file_manager = FileManager() if not file or not file_manager.save_file(file): return Response(status=400) saved_files = ImageTransform.make_transformations( file_manager.last_saved_full_path) saved_files["original"] = FileManager.extract_filename( file_manager.last_saved_full_path) dbm = DataBaseManager() db_success = dbm.add_photos(userID, "Auto Uploaded", "#test_image", saved_files) if db_success: return Response(status=200) else: return Response(status=500)
def create_session_for(username, password): pwd_manager = Hash() if pwd_manager.check_password(username, password): session['user'] = username session['authorized'] = True return True return False
def create_session_for(username, password): pwd_manager = Hash() if pwd_manager.check_password(username, password): session['user'] = username session['authorized'] = True dbm = DataBaseManager() session['type'] = dbm.get_user_type(username) return True return False
def authenticate_user(): username = request.form.get('username') password = request.form.get('password') pwd_manager = Hash() if pwd_manager.check_password(username, password): session['user'] = username session['authorized'] = True return redirect(url_for('render_gallery')) return render_template("index.html", error=True, username=username)