2019-12-07 23:40:42 +07:00
|
|
|
package handlers
|
|
|
|
|
2019-12-24 09:14:52 +07:00
|
|
|
import "github.com/authelia/authelia/internal/middlewares"
|
2019-12-07 23:40:42 +07:00
|
|
|
|
2020-04-21 04:03:38 +07:00
|
|
|
// ConfigurationBody configuration parameters exposed to the frontend.
|
2019-12-07 23:40:42 +07:00
|
|
|
type ConfigurationBody struct {
|
|
|
|
GoogleAnalyticsTrackingID string `json:"ga_tracking_id,omitempty"`
|
2020-04-05 06:28:09 +07:00
|
|
|
RememberMe bool `json:"remember_me"` // whether remember me is enabled or not
|
|
|
|
ResetPassword bool `json:"reset_password"`
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|
|
|
|
|
2020-04-21 04:03:38 +07:00
|
|
|
// ConfigurationGet fetches configuration parameters for frontend mutation.
|
2019-12-07 23:40:42 +07:00
|
|
|
func ConfigurationGet(ctx *middlewares.AutheliaCtx) {
|
|
|
|
body := ConfigurationBody{
|
|
|
|
GoogleAnalyticsTrackingID: ctx.Configuration.GoogleAnalyticsTrackingID,
|
2020-04-05 06:28:09 +07:00
|
|
|
RememberMe: ctx.Providers.SessionProvider.RememberMe != 0,
|
|
|
|
ResetPassword: !ctx.Configuration.AuthenticationBackend.DisableResetPassword,
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|
|
|
|
ctx.SetJSONBody(body)
|
|
|
|
}
|