Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES-412] Implemented signup banner to all the login screens #463

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,17 @@ crypto.PrependThumbprint.enable=true
mosip.esignet.ui.wallet.config={{'wallet.name': 'Inji', 'wallet.logo-url': 'inji_logo.png', 'wallet.download-uri': '#', \
'wallet.deep-link-uri': 'inji://landing-page-name?linkCode=LINK_CODE&linkExpireDateTime=LINK_EXPIRE_DT' }}

mosip.esignet.ui.signup.config={'signup.banner': true, 'signup.url': 'http://localhost:3000/signup'}

mosip.esignet.ui.config.key-values={'sbi.env': 'Developer', 'sbi.timeout.DISC': 30, \
'sbi.timeout.DINFO': 30, 'sbi.timeout.CAPTURE': 30, 'sbi.capture.count.face': 1, 'sbi.capture.count.finger': 2, \
'sbi.capture.count.iris': 1, 'sbi.capture.score.face': 70, 'sbi.capture.score.finger':70, 'sbi.capture.score.iris':70, \
'send.otp.channels':'email,phone', 'consent.screen.timeout-in-secs':${mosip.esignet.authentication-expire-in-secs}, \
'consent.screen.timeout-buffer-in-secs': 5, 'sbi.port.range': 4501-4600, 'sbi.bio.subtypes.iris': 'UNKNOWN', 'sbi.bio.subtypes.finger': 'UNKNOWN', \
'resend.otp.delay.secs': 120, 'captcha.enable': '', 'captcha.sitekey': '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', \
'linked-transaction-expire-in-secs': 120, 'wallet.qr-code-buffer-in-secs': 10, 'auth.txnid.length': 10, \
'otp.length': 6, 'password.regex': '', 'wallet.qr-code.auto-refresh-limit': 3, 'wallet.config': ${mosip.esignet.ui.wallet.config}}
'otp.length': 6, 'password.regex': '', 'wallet.qr-code.auto-refresh-limit': 3, 'wallet.config': ${mosip.esignet.ui.wallet.config}, \
'signup.config': ${mosip.esignet.ui.signup.config}}

## ---------------------------------------------- VCI ------------------------------------------------------------------

Expand Down
4 changes: 3 additions & 1 deletion oidc-ui/public/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@
"download_now": "التحميل الان",
"logo_alt": "e-Signet",
"backgroud_image_alt": "قم بتسجيل الدخول باستخدام e-Signet",
"language": "لغة"
"language": "لغة",
"noAccount": "ليس لديك حساب؟",
"signup_with_one_login": "قم بالتسجيل باستخدام نظام تسجيل الدخول الواحد"
},
"footer": {
"powered_by": "مشغل بواسطة",
Expand Down
4 changes: 3 additions & 1 deletion oidc-ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@
"download_now": "Download Now",
"logo_alt": "e-Signet",
"backgroud_image_alt": "Sign in with e-Signet",
"language": "Language"
"language": "Language",
"noAccount": "Don't have an account?",
"signup_with_one_login": "Sign Up with One-Login System"
},
"footer": {
"powered_by": "Powered by",
Expand Down
26 changes: 25 additions & 1 deletion oidc-ui/src/components/Background.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import React from "react";
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { configurationKeys } from "../constants/clientConstants";
import { useLocation } from "react-router-dom";

export default function Background({
heading,
clientLogoPath,
clientName,
component,
i18nKeyPrefix = "header",
oidcService
}) {
const { t } = useTranslation("translation", { keyPrefix: i18nKeyPrefix });

const location = useLocation();
const [signupBanner, setSignupBanner] = useState(false);
const [signupURL, setSignupURL] = useState("");

let signupConfig = oidcService.getEsignetConfiguration(
configurationKeys.signupConfig
);

useEffect(() => {
if(signupConfig?.[configurationKeys.signupBanner]) {
setSignupBanner(true);
setSignupURL(signupConfig[configurationKeys.signupURL] + location.search + location.hash)
}
}, []);

const backgroundLogo = process.env.REACT_APP_BACKGROUND_LOGO === "true";
const sectionClass = process.env.REACT_APP_FOOTER === "true" ? "flexible-header-footer" : "flexible-header-only";

Expand Down Expand Up @@ -52,6 +70,12 @@ export default function Background({
></div>
{component}
</div>
{/* Enable the signup banner when it is true in the signup.config of oauth-details */}
{signupBanner &&
<div className="text-center bg-[#FFF9F0] py-3 relative top-4 mt-2">
<p className="text-sm">{t("noAccount")}</p>
<a className="text-[#2F8EA3] hover:text-sky-600 focus:text-sky-600 font-semibold" href={signupURL} target="_self">{t("signup_with_one_login")}</a>
</div>}
</div>
</div>
</section>
Expand Down
5 changes: 4 additions & 1 deletion oidc-ui/src/constants/clientConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ const configurationKeys = {
consentScreenExpireInSec: "consent.screen.timeout-in-secs",
consentScreenTimeOutBufferInSec: "consent.screen.timeout-buffer-in-secs",
walletQrCodeAutoRefreshLimit: "wallet.qr-code.auto-refresh-limit",
walletConfig: "wallet.config"
walletConfig: "wallet.config",
signupConfig: "signup.config",
signupBanner: "signup.banner",
signupURL: "signup.url"
};

export {
Expand Down
1 change: 1 addition & 0 deletions oidc-ui/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export default function LoginPage({ i18nKeyPrefix = "header" }) {
clientLogoPath={clientLogoURL}
clientName={clientName}
component={compToShow}
oidcService={oidcService}
/>
</>
);
Expand Down