Skip to content

Commit

Permalink
admin: option link to my account page on login screen
Browse files Browse the repository at this point in the history
  • Loading branch information
hrfee committed Oct 2, 2023
1 parent 9956bbd commit 4f78b7c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/config-base.json
Expand Up @@ -418,6 +418,14 @@
"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. Note message cards are not private, little effort is required for anyone to view them."
},
"show_link": {
"name": "Show Link on Admin Login page",
"required": false,
"requires_restart": false,
"type": "bool",
"value": true,
"description": "Whether or not to show a link to the \"My Account\" page on the admin login screen, to direct lost users."
},
"referrals": {
"name": "User Referrals",
"required": false,
Expand Down
8 changes: 8 additions & 0 deletions html/login-modal.html
Expand Up @@ -7,6 +7,14 @@
</div>
{{ end }}
{{ end }}
{{ if index . "userPageEnabled" }}
{{ if and .userPageEnabled .showUserPageLink }}
<div class="card mx-2 flex-initial w-[100%] xl:w-[35%] mb-4 xl:mb-0 dark:~d_neutral @low content">
<span class="heading row">{{ .strings.loginNotAdmin }}</span>
<a class="button ~info h-12 w-100" href="{{ .urlBase }}/my/account"><i class="ri-account-circle-fill mr-2"></i>{{ .strings.myAccount }}</a>
</div>
{{ end }}
{{ end }}
<form class="card mx-2 flex-auto form-login w-[100%] xl:w-[55%] mb-0" href="">
<span class="heading">{{ .strings.login }}</span>
<input type="text" class="field input ~neutral @high mt-4 mb-2" placeholder="{{ .strings.username }}" id="login-user">
Expand Down
3 changes: 2 additions & 1 deletion lang/admin/en-us.json
Expand Up @@ -123,7 +123,8 @@
"userPageLogin": "User Page: Login",
"userPagePage": "User Page: Page",
"buildTime": "Build Time",
"builtBy": "Built By"
"builtBy": "Built By",
"loginNotAdmin": "Not an Admin?"
},
"notifications": {
"changedEmailAddress": "Changed email address of {n}.",
Expand Down
1 change: 1 addition & 0 deletions views.go
Expand Up @@ -175,6 +175,7 @@ func (app *appContext) AdminPage(gc *gin.Context) {
"jfAdminOnly": jfAdminOnly,
"jfAllowAll": jfAllowAll,
"userPageEnabled": app.config.Section("user_page").Key("enabled").MustBool(false),
"showUserPageLink": app.config.Section("user_page").Key("show_link").MustBool(true),
"referralsEnabled": app.config.Section("user_page").Key("enabled").MustBool(false) && app.config.Section("user_page").Key("referrals").MustBool(false),
"loginAppearance": app.config.Section("ui").Key("login_appearance").MustString("clear"),
})
Expand Down

0 comments on commit 4f78b7c

Please sign in to comment.