Skip to content

Authorize error page renders a hardcoded English heading beside a localized page title #208

Description

@leodip

Summary

The authorize error page mixes languages: its page title comes from the message catalog, its heading is a hardcoded English string. A pt-BR user meeting an authorize error sees a localized tab title and an English heading.

Details

renderErrorUi, the closure inside HandleAuthorizeGet in src/authserver/internal/handlers/handler_authorize.go, binds the heading as a Go string literal:

renderErrorUi := func(message string) {
    bind := map[string]interface{}{
        "title": "Unable to authorize",
        "error": message,
    }

    err := httpHelper.RenderTemplate(w, r, "/layouts/no_menu_layout.html", "/auth_error.html", bind)
    ...
}

auth_error.html renders {{.title}} as its <h1>, and separately renders its <title> from the catalog key auth_error.page_title, which exists in both locales:

$ grep -n "auth_error" src/core/i18n/catalogs/active.en.toml src/core/i18n/catalogs/active.pt-BR.toml
src/core/i18n/catalogs/active.en.toml:92:"auth_error.page_title" = "Error"
src/core/i18n/catalogs/active.pt-BR.toml:90:"auth_error.page_title" = "Erro"

There is no catalog key for the heading, so nothing to translate it with.

Impact

Cosmetic, and only on the error path, but it is a user-visible language mix on a page a non-English user can reach through an ordinary bad authorize request.

Suggested fix

Add a key for the heading to active.en.toml and active.pt-BR.toml and render it through i18n.T, the way the page title already is. Worth checking the other render sites of auth_error.html for the same pattern while there.

Found while grounding #79, which adds its own strings to both catalogs and does not touch this call site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgoPull requests that update Go code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions