def showWorkSpace(userName, accessID, accessToken): loginForm = forms.LoginForm() workflowForm = forms.newWorkflowForm() if fh.isAccessIdAuthentic(accessID): encodingKey = dc.generateHash(accessID) if isAccessTokenAuthentic(accessID, accessToken): userWorkspace = MLDC.getWorkspace(accessID) url = url_for("mlGUI_bp.showWorkSpace", userName=userName, accessID=accessID, accessToken=accessToken) return render_template('workspace.html', userName=userName, apiKey=accessID, encKey=encodingKey, accessToken=accessToken, workflowsList=userWorkspace, workflowUrl=url, status_message=status_msg, form=workflowForm) else: print("couldn't login") return render_template('login.html', form=loginForm, status="login-failed.")
def loginPage(): loginForm = forms.LoginForm() if request.method == 'POST': if loginForm.validate_on_submit(): print("INFO: ML_GUI: Form Data Validated.") userName = loginForm.userName.data password = loginForm.password.data status = authenticateCredentials(userName, password) if status == 0: print("Username/password combination validated.") accessID = dc.encryptWithSecretKey(userName) encodingKey = dc.generateHash(accessID) accessToken = generateAccessToken(userName, password, accessID, encodingKey) workspaces_url = url_for("mlGUI_bp.showWorkSpace", userName=userName, accessID=accessID, accessToken=accessToken) #workspaces_url = "192.168.0.192:5000" + workspaces_url #print(workspaces_url) return redirect(workspaces_url) elif status == 1: print("Invalid username.") return render_template('login.html', form=loginForm, status="Invalid usename," + userName + " does not exist in database.") elif status == 2: print("Incorrect password.") return render_template( 'login.html', form=loginForm, status="Incorrect password given for user: "******"login.html", form=loginForm) else: return make_response("Invalid http method", 404)
def showWorkflow(userName, accessID, accessToken, workflowID): loginForm = forms.LoginForm() if fh.isAccessIdAuthentic(accessID): encodingKey = dc.generateHash(accessID) if isAccessTokenAuthentic(accessID, accessToken): userWorkspace = MLDC.getWorkspace(accessID) workflow = userWorkspace[workflowID] return render_template('workflow.html', workflowName=workflow["workflow_Name"], workflowID=workflow["workflow_ID"], baseModel=workflow["baseModel"], processID=workflow["process_ID"], userName=userName, accessID=accessID, accessToken=accessToken, encodingKey=encodingKey, status_message=status_msg) else: print("couldn't login") return render_template('login.html', form=loginForm, status="Not sure")