25 lines
603 B
Go
25 lines
603 B
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func (b *BaseHandler) ConfirmRequestHandler(w http.ResponseWriter, req *http.Request) {
|
|
secret := req.FormValue("code")
|
|
request, err := b.requestRepo.FindBySecret(secret)
|
|
|
|
if err != nil {
|
|
w.WriteHeader(http.StatusNotFound)
|
|
Templates.ExecuteTemplate(w, "requestNotFound.html", struct{}{})
|
|
return
|
|
}
|
|
|
|
err = b.requestRepo.Execute(request)
|
|
if err != nil {
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
Templates.ExecuteTemplate(w, "executeFailure.html", err.Error())
|
|
return
|
|
}
|
|
Templates.ExecuteTemplate(w, "executeSuccess.html", struct{}{})
|
|
|
|
}
|