1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-06-18 07:27:49 +02:00

form: actually link to the my account page

forgot to do this before. shown on the success modal.
This commit is contained in:
Harvey Tindall 2023-06-22 21:57:19 +01:00
parent f07c60afb0
commit 7aaafb90e3
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
5 changed files with 13 additions and 3 deletions

View File

@ -403,7 +403,7 @@
"value": "",
"depends_true": "enabled",
"required": "false",
"description": "Click the edit icon next to the \"User Page\" Setting to add custom Markdown messages that will be shown to the user."
"description": "Click the edit icon next to the \"User Page\" Setting to add custom Markdown messages that will be shown to the user. Note message cards are not private, little effort is required for anyone to view them."
}
}
},

View File

@ -30,6 +30,7 @@
window.reCAPTCHA = {{ .reCAPTCHA }};
window.reCAPTCHASiteKey = "{{ .reCAPTCHASiteKey }}";
window.userPageEnabled = {{ .userPageEnabled }};
window.userPageAddress = "{{ .userPageAddress }}";
</script>
{{ if .passwordReset }}
<script src="js/pwr.js" type="module"></script>

View File

@ -26,7 +26,7 @@
window.validationStrings = JSON.parse({{ .validationStrings }});
</script>
{{ template "header.html" . }}
<title>{{ .lang.Strings.myAccount }}</title>
<title>{{ .strings.myAccount }}</title>
</head>
<body class="max-w-full overflow-x-hidden section">
<div id="modal-email" class="modal">

View File

@ -36,6 +36,7 @@ interface formWindow extends Window {
reCAPTCHA: boolean;
reCAPTCHASiteKey: string;
userPageEnabled: boolean;
userPageAddress: string;
}
loadLangSelector("form");
@ -348,7 +349,8 @@ const create = (event: SubmitEvent) => {
} else {
if (window.userPageEnabled) {
const userPageNoticeArea = document.getElementById("modal-success-user-page-area");
userPageNoticeArea.textContent = userPageNoticeArea.textContent.replace("{myAccount}", userPageNoticeArea.getAttribute("my-account-term"));
const link = `<a href="${window.userPageAddress}" target="_blank">${userPageNoticeArea.getAttribute("my-account-term")}</a>`;
userPageNoticeArea.innerHTML = userPageNoticeArea.textContent.replace("{myAccount}", link);
}
window.successModal.show();
}

View File

@ -596,6 +596,12 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
discord := discordEnabled && app.config.Section("discord").Key("show_on_reg").MustBool(true)
matrix := matrixEnabled && app.config.Section("matrix").Key("show_on_reg").MustBool(true)
userPageAddress := app.config.Section("invite_emails").Key("url_base").String()
if userPageAddress == "" {
userPageAddress = app.config.Section("password_resets").Key("url_base").String()
}
userPageAddress += "/my/account"
data := gin.H{
"urlBase": app.getURLBase(gc),
"cssClass": app.cssClass,
@ -630,6 +636,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"reCAPTCHA": app.config.Section("captcha").Key("recaptcha").MustBool(false),
"reCAPTCHASiteKey": app.config.Section("captcha").Key("recaptcha_site_key").MustString(""),
"userPageEnabled": app.config.Section("user_page").Key("enabled").MustBool(false),
"userPageAddress": userPageAddress,
}
if telegram {
data["telegramPIN"] = app.telegram.NewAuthToken()