mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
feat: support i18n in backend err messages (#1232)
* feat: support i18n in backend err messages * use gofumpt to fmt code * fix review problems * support auto generate err message * delete beego/i18n moudle * fix Github action test problems * fix review problems * use gofumpt to format code * use gofumpt to fmt code
This commit is contained in:
@ -24,6 +24,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/casdoor/casdoor/conf"
|
||||
"github.com/casdoor/casdoor/i18n"
|
||||
saml2 "github.com/russellhaering/gosaml2"
|
||||
dsig "github.com/russellhaering/goxmldsig"
|
||||
)
|
||||
@ -41,10 +42,10 @@ func ParseSamlResponse(samlResponse string, providerType string) (string, error)
|
||||
return assertionInfo.NameID, nil
|
||||
}
|
||||
|
||||
func GenerateSamlLoginUrl(id, relayState string) (string, string, error) {
|
||||
func GenerateSamlLoginUrl(id, relayState, lang string) (string, string, error) {
|
||||
provider := GetProvider(id)
|
||||
if provider.Category != "SAML" {
|
||||
return "", "", fmt.Errorf("provider %s's category is not SAML", provider.Name)
|
||||
return "", "", fmt.Errorf(i18n.Translate(lang, "ProviderErr.CategoryNotSAML"), provider.Name)
|
||||
}
|
||||
sp, err := buildSp(provider, "")
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user