mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-18 21:11:04 +01:00
Added mail notification support
This commit is contained in:
@@ -59,11 +59,20 @@ func FormCreate(c *fiber.Ctx, cfg *cfg.Config, db *Db) error {
|
||||
ex, err := common.Untaint(formdata.Expire, cfg.RegDuration) // duration or asap allowed
|
||||
if err != nil {
|
||||
return JsonStatus(c, fiber.StatusForbidden,
|
||||
"Invalid data: "+err.Error())
|
||||
"Invalid expire data: "+err.Error())
|
||||
}
|
||||
entry.Expire = ex
|
||||
}
|
||||
|
||||
if len(formdata.Notify) != 0 {
|
||||
nt, err := common.Untaint(formdata.Notify, cfg.RegEmail)
|
||||
if err != nil {
|
||||
return JsonStatus(c, fiber.StatusForbidden,
|
||||
"Invalid email address: "+err.Error())
|
||||
}
|
||||
entry.Notify = nt
|
||||
}
|
||||
|
||||
// get url [and zip if there are multiple files]
|
||||
returnUrl := strings.Join([]string{cfg.Url, "form", id}, "/")
|
||||
entry.Url = returnUrl
|
||||
|
||||
Reference in New Issue
Block a user