login-validator: New parameter -just-login

This commit is contained in:
nemunaire 2022-02-03 18:05:17 +01:00
commit d5a67e2bbb
2 changed files with 12 additions and 1 deletions

View file

@ -15,7 +15,10 @@ import (
"time"
)
var loginSalt string
var (
loginSalt string
justLogin bool
)
type loginChecker struct {
students []Student
@ -81,6 +84,12 @@ func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if justLogin {
log.Println("Successful login of", lu.Username, "at", r.RemoteAddr)
http.Error(w, "You're now successfully logged.", http.StatusOK)
return
}
// Find corresponding MAC
var ip net.IP
spl := strings.SplitN(r.RemoteAddr, ":", 2)