1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

referrals: show referrer username on form

This commit is contained in:
Harvey Tindall 2023-09-07 20:19:25 +01:00
parent 311ecb7030
commit 41c092f578
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
3 changed files with 18 additions and 5 deletions

View File

@ -43,7 +43,7 @@
<div id="notification-box"></div>
<div class="page-container">
<div class="card dark:~d_neutral @low">
<div class="flex flex-col md:flex-row gap-3 inline align-baseline">
<div class="flex flex-col justify-between md:flex-row gap-3 items-baseline mb-2">
<span class="heading mr-5">
{{ if .passwordReset }}
{{ .strings.passwordReset }}
@ -53,11 +53,14 @@
</span>
<span class="subheading">
{{ if .passwordReset }}
{{ .strings.enterYourPassword }}
{{ .strings.enterYourPassword }}
{{ else }}
{{ .helpMessage }}
{{ .helpMessage }}
{{ end }}
</span>
{{ if .fromUser }}
<span class="badge ~positive text-lg p-1 px-2 self-center">{{ .strings.invitedBy }} {{ .fromUser }}</span>
{{ end }}
</div>
<div class="flex flex-col md:flex-row gap-3">
<div class="flex-1">

View File

@ -36,7 +36,8 @@
"resetSentDescription": "If an account with the given username/contact method exists, a password reset link has been sent via all contact methods available. The code will expire in 30 minutes.",
"changePassword": "Change Password",
"referralsDescription": "Invite friends & family to Jellyfin with this link. Come back here for a new one if it expires.",
"copyReferral": "Copy Link"
"copyReferral": "Copy Link",
"invitedBy": "Invited By"
},
"notifications": {
"errorUserExists": "User already exists.",
@ -78,4 +79,4 @@
"plural": "Must have at least {n} special characters"
}
}
}
}

View File

@ -619,6 +619,14 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
}
userPageAddress += "/my/account"
fromUser := ""
if inv.ReferrerJellyfinID != "" {
sender, status, err := app.jf.UserByID(inv.ReferrerJellyfinID, false)
if status == 200 && err == nil {
fromUser = sender.Name
}
}
data := gin.H{
"urlBase": app.getURLBase(gc),
"cssClass": app.cssClass,
@ -654,6 +662,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"reCAPTCHASiteKey": app.config.Section("captcha").Key("recaptcha_site_key").MustString(""),
"userPageEnabled": app.config.Section("user_page").Key("enabled").MustBool(false),
"userPageAddress": userPageAddress,
"fromUser": fromUser,
}
if telegram {
data["telegramPIN"] = app.telegram.NewAuthToken()