Make mailvalidation stricter

This commit is contained in:
Gonne 2022-11-04 19:59:56 +01:00
parent b6ad8d848a
commit ec24c6c4dc
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,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) {
} else if !(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")