Korrigiere Prüfung von Mailsuffixen

This commit is contained in:
Gonne 2022-11-15 11:42:58 +01:00
parent f1dd952344
commit 231c8d7fd6

View file

@ -124,7 +124,7 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
if err != nil {
email = &mail.Address{Name: "", Address: req.FormValue("email")}
errors = append(errors, "Mailaddresse konnte nicht geparst werden.")
} else if !(strings.HasSuffix(email.Address, "@"+b.config.Tutor.MailSuffix) || strings.HasSuffix(email.Address, "."+b.config.Tutor.MailSuffix)) {
} else if !(b.config.Tutor.MailSuffix == "" || strings.HasSuffix(email.Address, "@"+b.config.Tutor.MailSuffix) || strings.HasSuffix(email.Address, "."+b.config.Tutor.MailSuffix)) {
errors = append(errors, fmt.Sprintf("Mailaddresse muss auf „%s“ enden.", b.config.Tutor.MailSuffix))
}
info := req.FormValue("info")