Explorar o código

Fixed bug on login/register with terms/privacy links.

KrisVos130 %!s(int64=7) %!d(string=hai) anos
pai
achega
3d48a2e683

+ 0 - 1
frontend/app/js/i18n.js

@@ -19,7 +19,6 @@ const i18n = i18next
 		},
 		ns: ["general"],
 		defaultNS: "general",
-		keySeparator: false, // we use content as keys
 		interpolation: {
 			escapeValue: false, // not needed for react!!
 			formatSeparator: ",",

+ 6 - 2
frontend/app/js/views/Auth/Login/index.jsx

@@ -1,9 +1,10 @@
 import React, { Component } from "react";
+import { NavLink } from "react-router-dom";
 
 import CustomInput from "components/CustomInput.jsx";
 import CustomMessages from "components/CustomMessages.jsx";
 import PropTypes from "prop-types";
-import { translate } from "react-i18next";
+import { translate, Trans } from "react-i18next";
 
 import "login.scss";
 
@@ -62,7 +63,10 @@ export default class Login extends Component {
 				<CustomMessages onRef={ ref => (this.messages = ref) } />
 				<CustomInput type="email" name="email" label={ t("general:emailInput") } placeholder={ t("general:emailInput") } onRef={ ref => (this.input.email = ref) } />
 				<CustomInput type="password" name="password" label={ t("general:passwordInput") } placeholder={ t("general:passwordInput") } onRef={ ref => (this.input.password = ref) } />
-				<p>{ t("login:byLoggingIn", { termsOfService: <a href="/terms">{ t("general:termsOfService") }</a>, privacyPolicy: <a href="/privacy">{ t("general:privacyPolicy") }</a> }) }</p>
+				<Trans i18nKey="login:byLoggingIn" parent="p">
+					<NavLink to="/terms"> </NavLink>
+					<NavLink to='/privacy'> </NavLink>
+				</Trans>
 				<button onClick={ this.login }>{ t("login:login") }</button>
 				<a href={ `${ config.serverDomain }/auth/github/authorize` } className="button gray-button" onClick={ this.githubRedirect }>
 					{ t("login:loginWithGitHub") }

+ 6 - 2
frontend/app/js/views/Auth/Register/index.jsx

@@ -1,9 +1,10 @@
 import React, { Component } from "react";
+import { NavLink } from "react-router-dom";
 
 import CustomInput from "components/CustomInput.jsx";
 import CustomMessages from "components/CustomMessages.jsx";
 import PropTypes from "prop-types";
-import { translate } from "react-i18next";
+import { translate, Trans } from "react-i18next";
 
 import "register.scss";
 
@@ -77,7 +78,10 @@ export default class Register extends Component {
 				<CustomInput type="username" name="username" label={ t("general:usernameInput") } placeholder={ t("general:usernameInput") } onRef={ ref => (this.input.username = ref) } />
 				<CustomInput type="password" name="password" label={ t("general:passwordInput") } placeholder={ t("general:passwordInput") } onRef={ ref => (this.input.password = ref) } />
 				<div id="recaptcha" />
-				<p>{ t("register:byLoggingIn", { termsOfService: <a href="/terms">{ t("general:termsOfService") }</a>, privacyPolicy: <a href="/privacy">{ t("general:privacyPolicy") }</a> }) }</p>
+				<Trans i18nKey="register:byLoggingIn" parent="p">
+					<NavLink to="/terms"> </NavLink>
+					<NavLink to='/privacy'> </NavLink>
+				</Trans>
 				<button onClick={ this.register }>{ t("register:register") }</button>
 				<a className="button gray-button" href={ `${ config.serverDomain }/auth/github/authorize` } onClick={ this.githubRedirect }>{ t("register:registerWithGitHub") }</a>
 			</main>