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