Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ TINYAUTH_UI_TITLE="Tinyauth"
TINYAUTH_UI_FORGOTPASSWORDMESSAGE="You can change your password by changing the configuration."
# Path to the background image.
TINYAUTH_UI_BACKGROUNDIMAGE="/background.jpg"
# Value of the CSS background property, takes precedence over the background image.
TINYAUTH_UI_BACKGROUNDCSS=
# Enable UI warnings.
TINYAUTH_UI_WARNINGSENABLED=true

Expand Down
14 changes: 9 additions & 5 deletions frontend/src/components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => {
return (
<div
className="flex flex-col justify-center items-center min-h-svh px-4"
style={{
backgroundImage: `url(${ui.backgroundImage})`,
backgroundSize: "cover",
backgroundPosition: "center",
}}
style={
ui.backgroundCss
? { background: ui.backgroundCss }
: {
backgroundImage: `url(${ui.backgroundImage})`,
backgroundSize: "cover",
backgroundPosition: "center",
}
}
>
<div className="absolute top-4 right-4">
<QuickActions />
Expand Down
1 change: 1 addition & 0 deletions frontend/src/schemas/app-context-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const uiSchema = z.object({
title: z.string(),
forgotPasswordMessage: z.string(),
backgroundImage: z.string(),
backgroundCss: z.string(),
warningsEnabled: z.boolean(),
});

Expand Down
2 changes: 2 additions & 0 deletions internal/controller/context_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type ACRUI struct {
Title string `json:"title"`
ForgotPasswordMessage string `json:"forgotPasswordMessage"`
BackgroundImage string `json:"backgroundImage"`
BackgroundCSS string `json:"backgroundCss"`
WarningsEnabled bool `json:"warningsEnabled"`
}

Expand Down Expand Up @@ -161,6 +162,7 @@ func (controller *ContextController) appContextHandler(c *gin.Context) {
Title: controller.config.UI.Title,
ForgotPasswordMessage: controller.config.UI.ForgotPasswordMessage,
BackgroundImage: controller.config.UI.BackgroundImage,
BackgroundCSS: controller.config.UI.BackgroundCSS,
WarningsEnabled: controller.config.UI.WarningsEnabled,
},
App: ACRApp{
Expand Down
1 change: 1 addition & 0 deletions internal/controller/context_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestContextController(t *testing.T) {
Title: cfg.UI.Title,
ForgotPasswordMessage: cfg.UI.ForgotPasswordMessage,
BackgroundImage: cfg.UI.BackgroundImage,
BackgroundCSS: cfg.UI.BackgroundCSS,
WarningsEnabled: cfg.UI.WarningsEnabled,
},
App: ACRApp{
Expand Down
1 change: 1 addition & 0 deletions internal/model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ type UIConfig struct {
Title string `description:"The title of the UI." yaml:"title,omitempty"`
ForgotPasswordMessage string `description:"Message displayed on the forgot password page." yaml:"forgotPasswordMessage,omitempty"`
BackgroundImage string `description:"Path to the background image." yaml:"backgroundImage,omitempty"`
BackgroundCSS string `description:"Value of the CSS background property, takes precedence over the background image." yaml:"backgroundCss,omitempty"`
WarningsEnabled bool `description:"Enable UI warnings." yaml:"warningsEnabled,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func CreateTestConfigs(t *testing.T) (model.Config, model.RuntimeConfig) {
Title: "Tinyauth Test",
ForgotPasswordMessage: "foo",
BackgroundImage: "/background.jpg",
BackgroundCSS: "linear-gradient(135deg, #03045e 0%, #0077b6 50%, #00b4d8 100%)",
WarningsEnabled: true,
},
OAuth: model.OAuthConfig{
Expand Down