暫無描述

logon.go 517B

    package handlers import ( "net/http" "code.revolvingcow.com/revolvingcow/loop/account" ) func LogonHandler(w http.ResponseWriter, r *http.Request) { email := r.FormValue("email") password := r.FormValue("password") a := account.Account{ Username: email, Passphrase: password, } err := a.Create() if err != nil { if err.Error() == "Account already exists" { http.Error(w, err.Error(), http.StatusInternalServerError) return } } http.Redirect(w, r, "/"+a.Username, http.StatusSeeOther) }