diff --git a/api.go b/api.go index 62a8b52..ab6b570 100644 --- a/api.go +++ b/api.go @@ -634,6 +634,12 @@ func (app *appContext) GenerateInvite(gc *gin.Context) { } else { invite.RemainingUses = 1 } + invite.UserDuration = req.UserDuration + if invite.UserDuration { + invite.UserDays = req.UserDays + invite.UserHours = req.UserHours + invite.UserMinutes = req.UserMinutes + } invite.ValidTill = validTill if emailEnabled && req.Email != "" && app.config.Section("invite_emails").Key("enabled").MustBool(false) { app.debug.Printf("%s: Sending invite email", inviteCode) @@ -813,14 +819,18 @@ func (app *appContext) GetInvites(gc *gin.Context) { for code, inv := range app.storage.invites { _, _, days, hours, minutes, _ := timeDiff(inv.ValidTill, currentTime) invite := inviteDTO{ - Code: code, - Days: days, - Hours: hours, - Minutes: minutes, - Created: app.formatDatetime(inv.Created), - Profile: inv.Profile, - NoLimit: inv.NoLimit, - Label: inv.Label, + Code: code, + Days: days, + Hours: hours, + Minutes: minutes, + UserDuration: inv.UserDuration, + UserDays: inv.UserDays, + UserHours: inv.UserHours, + UserMinutes: inv.UserMinutes, + Created: app.formatDatetime(inv.Created), + Profile: inv.Profile, + NoLimit: inv.NoLimit, + Label: inv.Label, } if len(inv.UsedBy) != 0 { invite.UsedBy = inv.UsedBy diff --git a/html/admin.html b/html/admin.html index 677745e..32bc995 100644 --- a/html/admin.html +++ b/html/admin.html @@ -259,23 +259,62 @@ {{ .strings.create }}
- -
- +
+ +
- -
- +
+ +
+ +
+ +
+ +
+ +
+ +
- -
- +
+

{{ .strings.userDurationDescription }}

+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
diff --git a/html/form-base.html b/html/form-base.html index 8a57868..0b2fe9c 100644 --- a/html/form-base.html +++ b/html/form-base.html @@ -7,6 +7,11 @@ window.code = "{{ .code }}"; window.messages = JSON.parse({{ .notifications }}); window.confirmation = {{ .confirmation }}; + window.userDurationEnabled = {{ .userDuration }}; + window.userDurationDays = {{ .userDurationDays }}; + window.userDurationHours = {{ .userDurationHours }}; + window.userDurationMinutes = {{ .userDurationMinutes }}; + window.userDurationMessage = {{ .userDurationMessage }}; {{ end }} diff --git a/html/form.html b/html/form.html index adb0117..a446871 100644 --- a/html/form.html +++ b/html/form.html @@ -37,6 +37,9 @@
+ {{ if .userDuration }} + + {{ end }}
- + - + - +