Make mfa pages translatable

This commit is contained in:
Tusooa Zhu 2022-02-28 11:07:28 -05:00
parent 50a316cd63
commit cadca083ea
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 57 additions and 8 deletions

View file

@ -6,6 +6,7 @@ defmodule Pleroma.Web.OAuth.MFAView do
use Pleroma.Web, :view
import Phoenix.HTML.Form
alias Pleroma.MFA
alias Pleroma.Web.Gettext
def render("mfa_response.json", %{token: token, user: user}) do
%{

View file

@ -5,11 +5,11 @@
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<% end %>
<h2>Two-factor recovery</h2>
<h2><%= Gettext.dpgettext("static_pages", "mfa recover page title", "Two-factor recovery") %></h2>
<%= form_for @conn, Routes.mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
<div class="input">
<%= label f, :code, "Recovery code" %>
<%= label f, :code, Gettext.dpgettext("static_pages", "mfa recover recovery code prompt", "Recovery code") %>
<%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, spellcheck: false] %>
<%= hidden_input f, :mfa_token, value: @mfa_token %>
<%= hidden_input f, :state, value: @state %>
@ -17,8 +17,8 @@
<%= hidden_input f, :challenge_type, value: "recovery" %>
</div>
<%= submit "Verify" %>
<%= submit Gettext.dpgettext("static_pages", "mfa recover verify recovery code button", "Verify") %>
<% end %>
<a href="<%= Routes.mfa_path(@conn, :show, %{challenge_type: "totp", mfa_token: @mfa_token, state: @state, redirect_uri: @redirect_uri}) %>">
Enter a two-factor code
<%= Gettext.dpgettext("static_pages", "mfa recover use 2fa code link", "Enter a two-factor code") %>
</a>

View file

@ -5,11 +5,11 @@
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<% end %>
<h2>Two-factor authentication</h2>
<h2><%= Gettext.dpgettext("static_pages", "mfa auth page title", "Two-factor authentication") %></h2>
<%= form_for @conn, Routes.mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
<div class="input">
<%= label f, :code, "Authentication code" %>
<%= label f, :code, Gettext.dpgettext("static_pages", "mfa auth code prompt", "Authentication code") %>
<%= text_input f, :code, [autocomplete: "one-time-code", autocorrect: "off", autocapitalize: "off", autofocus: true, pattern: "[0-9]*", spellcheck: false] %>
<%= hidden_input f, :mfa_token, value: @mfa_token %>
<%= hidden_input f, :state, value: @state %>
@ -17,8 +17,8 @@
<%= hidden_input f, :challenge_type, value: "totp" %>
</div>
<%= submit "Verify" %>
<%= submit Gettext.dpgettext("static_pages", "mfa auth verify code button", "Verify") %>
<% end %>
<a href="<%= Routes.mfa_path(@conn, :show, %{challenge_type: "recovery", mfa_token: @mfa_token, state: @state, redirect_uri: @redirect_uri}) %>">
Enter a two-factor recovery code
<%= Gettext.dpgettext("static_pages", "mfa auth page use recovery code link", "Enter a two-factor recovery code") %>
</a>

View file

@ -305,3 +305,51 @@ msgstr ""
msgctxt "oauth token code message"
msgid "Token code is <br>%{token}"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:12
msgctxt "mfa auth code prompt"
msgid "Authentication code"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:8
msgctxt "mfa auth page title"
msgid "Two-factor authentication"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:23
msgctxt "mfa auth page use recovery code link"
msgid "Enter a two-factor recovery code"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:20
msgctxt "mfa auth verify code button"
msgid "Verify"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:8
msgctxt "mfa recover page title"
msgid "Two-factor recovery"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:12
msgctxt "mfa recover recovery code prompt"
msgid "Recovery code"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:23
msgctxt "mfa recover use 2fa code link"
msgid "Enter a two-factor code"
msgstr ""
#, elixir-format
#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:20
msgctxt "mfa recover verify recovery code button"
msgid "Verify"
msgstr ""