Added basic debug view
This commit is contained in:
+25
-24
@@ -18,7 +18,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
//"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -797,43 +797,44 @@ func parseLoginParameters(resp http.ResponseWriter, request *http.Request) (logi
|
||||
}
|
||||
|
||||
// Can check against HIBP etc?
|
||||
// Removed for localhost
|
||||
func checkPasswordStrength(password string) error {
|
||||
// Check password strength here
|
||||
if len(password) < 10 {
|
||||
return errors.New("Minimum password length is 10.")
|
||||
}
|
||||
//if len(password) < 10 {
|
||||
// return errors.New("Minimum password length is 10.")
|
||||
//}
|
||||
|
||||
if len(password) > 128 {
|
||||
return errors.New("Maximum password length is 128.")
|
||||
}
|
||||
//if len(password) > 128 {
|
||||
// return errors.New("Maximum password length is 128.")
|
||||
//}
|
||||
|
||||
re := regexp.MustCompile("[0-9]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain a number")
|
||||
}
|
||||
//re := regexp.MustCompile("[0-9]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain a number")
|
||||
//}
|
||||
|
||||
re = regexp.MustCompile("[a-z]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain a lower case char")
|
||||
}
|
||||
//re = regexp.MustCompile("[a-z]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain a lower case char")
|
||||
//}
|
||||
|
||||
re = regexp.MustCompile("[A-Z]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain an upper case char")
|
||||
}
|
||||
//re = regexp.MustCompile("[A-Z]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain an upper case char")
|
||||
//}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fuck emails
|
||||
// No more emails :)
|
||||
func checkUsername(Username string) error {
|
||||
// Stupid first check of email loool
|
||||
if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
||||
return errors.New("Invalid Username")
|
||||
}
|
||||
//if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
||||
// return errors.New("Invalid Username")
|
||||
//}
|
||||
|
||||
if len(Username) < 4 {
|
||||
return errors.New("Minimum Username length is 2")
|
||||
return errors.New("Minimum Username length is 4")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -777,16 +777,21 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
||||
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
||||
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
||||
finished := true
|
||||
lastResult := ""
|
||||
for _, result := range workflowExecution.Results {
|
||||
if result.Status != "SUCCESS" && result.Status != "FINISHED" {
|
||||
finished = false
|
||||
break
|
||||
}
|
||||
|
||||
lastResult = result.Result
|
||||
}
|
||||
|
||||
if finished {
|
||||
log.Printf("Execution of %s finished.", workflowExecution.ExecutionId)
|
||||
//log.Println("Might be finished based on length of results and everything being SUCCESS or FINISHED - VERIFY THIS. Setting status to finished.")
|
||||
|
||||
workflowExecution.Result = lastResult
|
||||
workflowExecution.Status = "FINISHED"
|
||||
workflowExecution.CompletedAt = int64(time.Now().Unix())
|
||||
if workflowExecution.LastNode == "" {
|
||||
|
||||
Reference in New Issue
Block a user