Login für eingeladene Prüflinge implementiert
This commit is contained in:
@ -92,3 +92,23 @@ func GenerateUUID(ch chan<- string) http.HandlerFunc {
|
||||
template.Must(template.ParseFiles("templates/form.html")).ExecuteTemplate(w, "uuid", uuid)
|
||||
}
|
||||
}
|
||||
|
||||
func DisplayQuestionsIfOK(uuids *[]string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if uuidIsOK(r.PostFormValue("login"), uuids) {
|
||||
template.Must(template.ParseFiles("templates/question.html")).ExecuteTemplate(w, "content", nil)
|
||||
} else {
|
||||
template.Must(template.ParseFiles("templates/login.html")).ExecuteTemplate(w, "content", nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Delete uuid from uuids
|
||||
func uuidIsOK(uuid string, uuids *[]string) bool {
|
||||
for _, u := range *uuids {
|
||||
if uuid == u {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user