Deaktiviere das Löschen von Sprechstunden wegen Spam
This commit is contained in:
parent
12a5080659
commit
8654263798
5 changed files with 15 additions and 8 deletions
|
@ -3,7 +3,7 @@ package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"officeHours/models"
|
//"officeHours/models"
|
||||||
"officeHours/templating"
|
"officeHours/templating"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
@ -12,16 +12,16 @@ func (b *BaseHandler) DeleteOfficeHourHandler(w http.ResponseWriter, req *http.R
|
||||||
// TODO: error handling here is by no means sufficient, furthermore
|
// TODO: error handling here is by no means sufficient, furthermore
|
||||||
// 400 BadRequest is for technically wrong stuff (most promimently GET instead of POST)
|
// 400 BadRequest is for technically wrong stuff (most promimently GET instead of POST)
|
||||||
if req.FormValue("id") != "" {
|
if req.FormValue("id") != "" {
|
||||||
id, err := strconv.Atoi(req.FormValue("id"))
|
_, err := strconv.Atoi(req.FormValue("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
officeHour, err := b.officeHourRepo.FindById(id)
|
//officeHour, err := b.officeHourRepo.FindById(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
|
//_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
|
||||||
templating.ServeTemplate(w, "deleteSuccess", nil)
|
templating.ServeTemplate(w, "deleteDisabled", nil)
|
||||||
} else {
|
} else {
|
||||||
officeHours, _ := b.officeHourRepo.GetAll(true)
|
officeHours, _ := b.officeHourRepo.GetAll(true)
|
||||||
timetable, slots := b.GetTimetable(officeHours)
|
timetable, slots := b.GetTimetable(officeHours)
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -2,6 +2,6 @@ module officeHours
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require github.com/mattn/go-sqlite3 v1.14.15
|
require github.com/mattn/go-sqlite3 v1.14.16
|
||||||
|
|
||||||
require github.com/go-sql-driver/mysql v1.6.0
|
require github.com/go-sql-driver/mysql v1.6.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,4 +1,4 @@
|
||||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
|
|
|
@ -44,6 +44,7 @@ func InitTemplates() error {
|
||||||
"addMask": {"addMask.html", false},
|
"addMask": {"addMask.html", false},
|
||||||
"addSuccess": {"addSuccess.html", false},
|
"addSuccess": {"addSuccess.html", false},
|
||||||
"deleteSuccess": {"deleteSuccess.html", false},
|
"deleteSuccess": {"deleteSuccess.html", false},
|
||||||
|
"deleteDisabled": {"deleteDisabled.html", false},
|
||||||
"executeFailure": {"executeFailure.html", false},
|
"executeFailure": {"executeFailure.html", false},
|
||||||
"executeSuccess": {"executeSuccess.html", false},
|
"executeSuccess": {"executeSuccess.html", false},
|
||||||
"index": {"index.html", false},
|
"index": {"index.html", false},
|
||||||
|
|
6
templating/templates/deleteDisabled.html
Normal file
6
templating/templates/deleteDisabled.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{{define "title"}}Sprechstunde löschen{{end}}
|
||||||
|
|
||||||
|
{{define "content"}}
|
||||||
|
Sprechstunden zu löschen wurde wegen zu viel Spam deaktiviert. <br>
|
||||||
|
Falls du deine Sprechstunde löschen möchtest, melde dich bitte unter <a href="mailto:sprechstundentool@mathebau.de">sprechstundentool@mathebau.de</a>.
|
||||||
|
{{end}}
|
Loading…
Reference in a new issue