diff --git a/lang/admin/en-us.json b/lang/admin/en-us.json
index b3a1e61..7de1729 100644
--- a/lang/admin/en-us.json
+++ b/lang/admin/en-us.json
@@ -137,6 +137,8 @@
"jellyfinID": "Jellyfin ID",
"userPageLogin": "User Page: Login",
"userPagePage": "User Page: Page",
+ "postSignupCard": "Post-signup help card",
+ "postSignupCardDescription": "Card shown to user after signing up. Overrides \"Success Message\". Overriden by \"Auto redirect on success\" setting.",
"buildTime": "Build Time",
"builtBy": "Built By",
"loginNotAdmin": "Not an Admin?",
diff --git a/migrations.go b/migrations.go
index 209612c..bf16336 100644
--- a/migrations.go
+++ b/migrations.go
@@ -339,7 +339,7 @@ func migrateToBadger(app *appContext) {
app.info.Println("All data migrated to database. JSON files in the config folder can be deleted if you are sure all data is correct in the app. Create an issue if you have problems.")
}
-// Simply creates an emply CC template if not imn the DB already.
+// Simply creates an emply CC template if not in the DB already.
// Add new CC types here!
func intialiseCustomContent(app *appContext) {
emptyCC := CustomContent{
@@ -384,6 +384,10 @@ func intialiseCustomContent(app *appContext) {
if _, ok := app.storage.GetCustomContentKey("UserExpiryAdjusted"); !ok {
app.storage.SetCustomContentKey("UserExpiryAdjusted", emptyCC)
}
+ if _, ok := app.storage.GetCustomContentKey("PostSignupCard"); !ok {
+ app.storage.SetCustomContentKey("PostSignupCard", emptyCC)
+
+ }
}
// Migrate between hyphenated & non-hyphenated user IDs. Doesn't seem to happen anymore, so disabled.
diff --git a/models.go b/models.go
index 714be96..ac1a1df 100644
--- a/models.go
+++ b/models.go
@@ -239,8 +239,9 @@ type langDTO map[string]string
type emailListDTO map[string]emailListEl
type emailListEl struct {
- Name string `json:"name"`
- Enabled bool `json:"enabled"`
+ Name string `json:"name"`
+ Enabled bool `json:"enabled"`
+ Description string `json:"description"`
}
type emailSetDTO struct {
diff --git a/ts/form.ts b/ts/form.ts
index ef4b555..873ed79 100644
--- a/ts/form.ts
+++ b/ts/form.ts
@@ -38,6 +38,7 @@ interface formWindow extends Window {
reCAPTCHASiteKey: string;
userPageEnabled: boolean;
userPageAddress: string;
+ customSuccessCard: boolean;
}
loadLangSelector("form");
@@ -296,7 +297,10 @@ const create = (event: SubmitEvent) => {
const url = ((document.getElementById("modal-success") as HTMLDivElement).querySelector("a.submit") as HTMLAnchorElement).href;
window.location.href = url;
} else {
- if (window.userPageEnabled) {
+ if (window.customSuccessCard) {
+ const content = window.successModal.asElement().querySelector(".card");
+ content.innerHTML = content.innerHTML.replace(new RegExp("{username}", "g"), send.username)
+ } else if (window.userPageEnabled) {
const userPageNoticeArea = document.getElementById("modal-success-user-page-area");
const link = `
${userPageNoticeArea.getAttribute("my-account-term")}`;
userPageNoticeArea.innerHTML = userPageNoticeArea.textContent.replace("{myAccount}", link);
diff --git a/ts/modules/settings.ts b/ts/modules/settings.ts
index 2dc1e10..321b3be 100644
--- a/ts/modules/settings.ts
+++ b/ts/modules/settings.ts
@@ -1083,6 +1083,7 @@ export interface templateEmail {
interface emailListEl {
name: string;
enabled: boolean;
+ description: string;
}
class MessageEditor {
@@ -1092,6 +1093,7 @@ class MessageEditor {
private _templ: templateEmail;
private _form = document.getElementById("form-editor") as HTMLFormElement;
private _header = document.getElementById("header-editor") as HTMLSpanElement;
+ private _aside = document.getElementById("aside-editor") as HTMLElement;
private _variables = document.getElementById("editor-variables") as HTMLDivElement;
private _variablesLabel = document.getElementById("label-editor-variables") as HTMLElement;
private _conditionals = document.getElementById("editor-conditionals") as HTMLDivElement;
@@ -1113,6 +1115,12 @@ class MessageEditor {
if (this._names[id] !== undefined) {
this._header.textContent = this._names[id].name;
}
+ this._aside.classList.add("unfocused");
+ if (this._names[id].description != "") {
+ this._aside.textContent = this._names[id].description;
+ this._aside.classList.remove("unfocused");
+ }
+
this._templ = req.response as templateEmail;
this._textArea.value = this._templ.content;
if (this._templ.html == "") {
@@ -1212,11 +1220,22 @@ class MessageEditor {
if (this._names[id].enabled) {
resetButton = `
`;
}
- tr.innerHTML = `
-
${this._names[id].name} |
+ let innerHTML = `
+
+ ${this._names[id].name}
+ `;
+ if (this._names[id].description != "") innerHTML += `
+
+
+ ${this._names[id].description}
+
+ `;
+ innerHTML += `
+ |
${resetButton} |
|
`;
+ tr.innerHTML = innerHTML;
(tr.querySelector("span.button") as HTMLSpanElement).onclick = () => {
window.modals.customizeEmails.close()
this.loadEditor(id);
diff --git a/views.go b/views.go
index c330b7c..e342191 100644
--- a/views.go
+++ b/views.go
@@ -271,13 +271,14 @@ func (app *appContext) ResetPassword(gc *gin.Context) {
app.pushResources(gc, PWRPage)
lang := app.getLang(gc, PWRPage, app.storage.lang.chosenPWRLang)
data := gin.H{
- "urlBase": app.getURLBase(gc),
- "cssClass": app.cssClass,
- "cssVersion": cssVersion,
- "contactMessage": app.config.Section("ui").Key("contact_message").String(),
- "strings": app.storage.lang.PasswordReset[lang].Strings,
- "success": false,
- "ombiEnabled": app.config.Section("ombi").Key("enabled").MustBool(false),
+ "urlBase": app.getURLBase(gc),
+ "cssClass": app.cssClass,
+ "cssVersion": cssVersion,
+ "contactMessage": app.config.Section("ui").Key("contact_message").String(),
+ "strings": app.storage.lang.PasswordReset[lang].Strings,
+ "success": false,
+ "ombiEnabled": app.config.Section("ombi").Key("enabled").MustBool(false),
+ "customSuccessCard": false,
}
pwr, isInternal := app.internalPWRs[pin]
// if isInternal && setPassword {
@@ -734,6 +735,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"userExpiryMessage": app.storage.lang.User[lang].Strings.get("yourAccountIsValidUntil"),
"langName": lang,
"passwordReset": false,
+ "customSuccessCard": false,
"telegramEnabled": telegram,
"discordEnabled": discord,
"matrixEnabled": matrix,
@@ -766,6 +768,22 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
data["discordServerName"] = app.discord.serverName
data["discordInviteLink"] = app.discord.inviteChannelName != ""
}
+ if msg, ok := app.storage.GetCustomContentKey("PostSignupCard"); ok && msg.Enabled {
+ data["customSuccessCard"] = true
+ // We don't template here, since the username is only known after login.
+ data["customSuccessCardContent"] = template.HTML(markdown.ToHTML(
+ []byte(templateEmail(
+ msg.Content,
+ msg.Variables,
+ msg.Conditionals,
+ map[string]interface{}{
+ "username": "{username}",
+ "myAccountURL": userPageAddress,
+ },
+ ),
+ ), nil, markdownRenderer,
+ ))
+ }
// if discordEnabled {
// pin := ""