2020-12-31 09:42:48 +01:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
|
|
|
|
2021-01-01 09:20:49 +01:00
|
|
|
"git.cacert.org/oidc_login/common/services"
|
2020-12-31 09:42:48 +01:00
|
|
|
)
|
|
|
|
|
2021-01-01 09:20:49 +01:00
|
|
|
func AddMessages(ctx context.Context) {
|
2020-12-31 19:11:06 +01:00
|
|
|
messages := make(map[string]*i18n.Message)
|
|
|
|
messages["unknown"] = &i18n.Message{
|
2020-12-31 09:42:48 +01:00
|
|
|
ID: "ErrorUnknown",
|
|
|
|
Other: "Unknown error",
|
|
|
|
}
|
2020-12-31 19:11:06 +01:00
|
|
|
messages["email"] = &i18n.Message{
|
2020-12-31 09:42:48 +01:00
|
|
|
ID: "ErrorEmail",
|
|
|
|
Other: "Please enter a valid email address.",
|
|
|
|
}
|
2020-12-31 19:11:06 +01:00
|
|
|
messages["Email-required"] = &i18n.Message{
|
2020-12-31 09:42:48 +01:00
|
|
|
ID: "ErrorEmailRequired",
|
|
|
|
Other: "Please enter an email address.",
|
|
|
|
}
|
2020-12-31 19:11:06 +01:00
|
|
|
messages["required"] = &i18n.Message{
|
2020-12-31 09:42:48 +01:00
|
|
|
ID: "ErrorRequired",
|
|
|
|
Other: "Please enter a value",
|
|
|
|
}
|
2020-12-31 19:11:06 +01:00
|
|
|
messages["Password-required"] = &i18n.Message{
|
2020-12-31 09:42:48 +01:00
|
|
|
ID: "ErrorPasswordRequired",
|
|
|
|
Other: "Please enter a password.",
|
|
|
|
}
|
2020-12-31 19:11:06 +01:00
|
|
|
messages["TitleRequestConsent"] = &i18n.Message{
|
|
|
|
ID: "TitleRequestConsent",
|
|
|
|
Other: "Application requests your consent",
|
|
|
|
}
|
|
|
|
messages["LabelSubmit"] = &i18n.Message{
|
|
|
|
ID: "LabelSubmit",
|
|
|
|
Other: "Submit",
|
|
|
|
}
|
|
|
|
messages["LabelConsent"] = &i18n.Message{
|
|
|
|
ID: "LabelConsent",
|
|
|
|
Other: "I hereby agree that the application may get the requested permissions.",
|
|
|
|
}
|
|
|
|
messages["IntroConsentRequested"] = &i18n.Message{
|
|
|
|
ID: "IntroConsentRequested",
|
|
|
|
Other: "The <strong>{{ .client }}</strong> application wants your consent for the requested set of permissions.",
|
|
|
|
}
|
|
|
|
messages["IntroConsentMoreInformation"] = &i18n.Message{
|
|
|
|
ID: "IntroConsentMoreInformation",
|
|
|
|
Other: "You can find more information about <strong>{{ .client }}</strong> at <a href=\"{{ .clientLink }}\">its description page</a>.",
|
|
|
|
}
|
|
|
|
messages["Scope-openid-Description"] = &i18n.Message{
|
|
|
|
ID: "Scope-openid-Description",
|
|
|
|
Other: "Request information about your identity.",
|
|
|
|
}
|
|
|
|
messages["Scope-offline_access-Description"] = &i18n.Message{
|
|
|
|
ID: "Scope-offline_access-Description",
|
|
|
|
Other: "Keep access to your information until you revoke the permission.",
|
|
|
|
}
|
|
|
|
messages["Scope-profile-Description"] = &i18n.Message{
|
|
|
|
ID: "Scope-profile-Description",
|
|
|
|
Other: "Access your user profile information including your name, birth date and locale.",
|
|
|
|
}
|
|
|
|
messages["Scope-email-Description"] = &i18n.Message{
|
|
|
|
ID: "Scope-email-Description",
|
|
|
|
Other: "Access your primary email address.",
|
|
|
|
}
|
2021-01-01 09:20:49 +01:00
|
|
|
services.GetMessageCatalog(ctx).AddMessages(messages)
|
2020-12-31 09:42:48 +01:00
|
|
|
}
|