diff --git a/patches/patches.json b/patches/patches.json index daef693c66..f167f77cc1 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -67,6 +67,8 @@ }, "registration-for-mainlining": { "package": "matrix-react-sdk", + "comments": "registration process is customized", + "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/460", "files": [ "src/components/structures/auth/Registration.tsx", "src/components/views/auth/RegistrationForm.tsx" diff --git a/patches/registration-for-mainlining/matrix-react-sdk+3.68.0.patch b/patches/registration-for-mainlining/matrix-react-sdk+3.68.0.patch index 9af253efe9..069f3d883a 100644 --- a/patches/registration-for-mainlining/matrix-react-sdk+3.68.0.patch +++ b/patches/registration-for-mainlining/matrix-react-sdk+3.68.0.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/matrix-react-sdk/src/components/structures/auth/Registration.tsx b/node_modules/matrix-react-sdk/src/components/structures/auth/Registration.tsx -index dd9be19..4226280 100644 +index dd9be19..144efa3 100644 --- a/node_modules/matrix-react-sdk/src/components/structures/auth/Registration.tsx +++ b/node_modules/matrix-react-sdk/src/components/structures/auth/Registration.tsx -@@ -39,8 +39,10 @@ import InteractiveAuth, { InteractiveAuthCallback } from "../InteractiveAuth"; +@@ -39,8 +39,11 @@ import InteractiveAuth, { InteractiveAuthCallback } from "../InteractiveAuth"; import Spinner from "../../views/elements/Spinner"; import { AuthHeaderDisplay } from "./header/AuthHeaderDisplay"; import { AuthHeaderProvider } from "./header/AuthHeaderProvider"; @@ -10,10 +10,11 @@ index dd9be19..4226280 100644 import SettingsStore from "../../../settings/SettingsStore"; import { ValidatedServerConfig } from "../../../utils/ValidatedServerConfig"; +import TchapUtils from '../../../../../../src/util/TchapUtils'; // :TCHAP: ++import TchapUrls from "../../../../../../src/util/TchapUrls"; const debuglog = (...args: any[]): void => { if (SettingsStore.getValue("debug_registration")) { -@@ -277,11 +279,22 @@ export default class Registration extends React.Component { +@@ -277,11 +280,22 @@ export default class Registration extends React.Component { } private onFormSubmit = async (formVals: Record): Promise => { @@ -36,7 +37,7 @@ index dd9be19..4226280 100644 }); }; -@@ -296,7 +309,10 @@ export default class Registration extends React.Component { +@@ -296,7 +310,10 @@ export default class Registration extends React.Component { emailAddress, clientSecret, sendAttempt, @@ -48,7 +49,16 @@ index dd9be19..4226280 100644 client_secret: clientSecret, hs_url: this.state.matrixClient.getHomeserverUrl(), is_url: this.state.matrixClient.getIdentityServerUrl(), -@@ -476,6 +492,11 @@ export default class Registration extends React.Component { +@@ -341,6 +358,8 @@ export default class Registration extends React.Component { + errorText = _t("Someone already has that username, please try another."); + } else if (response instanceof MatrixError && response.errcode === "M_THREEPID_IN_USE") { + errorText = _t("That e-mail address or phone number is already in use."); ++ } else if (response instanceof MatrixError && response.errcode === "M_THREEPID_DENIED") { ++ errorText = _t("That email is not allowed on Tchap", {}, {a: (sub)=>{sub}}); + } + + this.setState({ +@@ -476,6 +495,11 @@ export default class Registration extends React.Component { inhibit_login: undefined, }; if (auth) registerParams.auth = auth; @@ -60,7 +70,7 @@ index dd9be19..4226280 100644 debuglog("Registration: sending registration request:", auth); return this.state.matrixClient.registerRequest(registerParams); }; -@@ -515,7 +536,7 @@ export default class Registration extends React.Component { +@@ -515,7 +539,7 @@ export default class Registration extends React.Component { sessionId={this.props.sessionId} clientSecret={this.props.clientSecret} emailSid={this.props.idSid} @@ -69,7 +79,7 @@ index dd9be19..4226280 100644 /> ); } else if (!this.state.matrixClient && !this.state.busy) { -@@ -711,6 +732,12 @@ export default class Registration extends React.Component { +@@ -711,6 +735,12 @@ export default class Registration extends React.Component { {errorText} {serverDeadSection} diff --git a/res/themes/tchap-common/css/_tchap_custom.pcss b/res/themes/tchap-common/css/_tchap_custom.pcss index 8d16beab04..10ee8407ad 100644 --- a/res/themes/tchap-common/css/_tchap_custom.pcss +++ b/res/themes/tchap-common/css/_tchap_custom.pcss @@ -17,3 +17,9 @@ div.mx_SettingsTab.mx_SecurityUserSettingsTab > div:nth-child(4) > div:nth-child(2) { display: none; } + +/* change link color and decoration in login error when email is not autorized */ +.mx_Login_error.mx_Login_error_link{ + color: $alert important!; + text-decoration: underline important!; +} \ No newline at end of file diff --git a/src/i18n/strings/tchap_translations.json b/src/i18n/strings/tchap_translations.json index 4398f48dfc..a6f7c59cc7 100644 --- a/src/i18n/strings/tchap_translations.json +++ b/src/i18n/strings/tchap_translations.json @@ -807,6 +807,10 @@ "fr": "Clés Tchap :", "en": "Tchap keys:" }, + "That email is not allowed on Tchap" : { + "fr": "Votre adresse mail n'est pas autorisée sur Tchap. Demandez l'accès à Tchap pour votre administration via ce formulaire", + "en": "Your email adress is not allowed on Tchap. Make an autorization request here" + }, "Generate a new code": { "fr": "Générer un nouveau code", "en": "Generate a new code" diff --git a/src/util/TchapUrls.ts b/src/util/TchapUrls.ts new file mode 100644 index 0000000000..7dd0bfcabd --- /dev/null +++ b/src/util/TchapUrls.ts @@ -0,0 +1,8 @@ + + +export default class TchapUrls { + + //url to request the opening of a new domain on Tchap + public static requestDomainUrl = "https://www.demarches-simplifiees.fr/commencer/utiliser-tchap"; + +} \ No newline at end of file