From bd78f79d61cec6f219915951eec8771c421d7138 Mon Sep 17 00:00:00 2001 From: LEGO Technix <109212476+lego-technix@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:08:37 +0200 Subject: [PATCH 1/5] feat(api): add OIDC Providers slug to JSON API --- .../serializers/jsonapi/oidc-identity-providers.serializer.js | 3 ++- .../acceptance/application/oidc-provider.admin.route.test.js | 1 + .../acceptance/application/oidc-provider.route.test.js | 1 + .../unit/application/oidc-provider.admin.controller.test.js | 2 ++ .../unit/application/oidc-provider.controller.test.js | 1 + .../jsonapi/oidc-identity-providers.serializer.test.js | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/identity-access-management/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.js b/api/src/identity-access-management/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.js index e451c0f425a..b680185b33a 100644 --- a/api/src/identity-access-management/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.js +++ b/api/src/identity-access-management/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.js @@ -9,11 +9,12 @@ const serialize = function (oidcIdentityProviders) { id: oidcIdentityProvider.slug, code: oidcIdentityProvider.code, organizationName: oidcIdentityProvider.organizationName, + slug: oidcIdentityProvider.slug, shouldCloseSession: oidcIdentityProvider.shouldCloseSession, source: oidcIdentityProvider.source, }; }, - attributes: ['code', 'organizationName', 'shouldCloseSession', 'source'], + attributes: ['code', 'organizationName', 'slug', 'shouldCloseSession', 'source'], }).serialize(oidcIdentityProviders); }; diff --git a/api/tests/identity-access-management/acceptance/application/oidc-provider.admin.route.test.js b/api/tests/identity-access-management/acceptance/application/oidc-provider.admin.route.test.js index 804f653fc9c..2cf527380e4 100644 --- a/api/tests/identity-access-management/acceptance/application/oidc-provider.admin.route.test.js +++ b/api/tests/identity-access-management/acceptance/application/oidc-provider.admin.route.test.js @@ -77,6 +77,7 @@ describe('Acceptance | Identity Access Management | Route | Admin | oidc-provide attributes: { code: 'OIDC_EXAMPLE_NET', 'organization-name': 'OIDC Example', + slug: 'oidc-example-net', 'should-close-session': true, source: 'oidcexamplenet', }, diff --git a/api/tests/identity-access-management/acceptance/application/oidc-provider.route.test.js b/api/tests/identity-access-management/acceptance/application/oidc-provider.route.test.js index 1ea2393c9c2..d3131f969f0 100644 --- a/api/tests/identity-access-management/acceptance/application/oidc-provider.route.test.js +++ b/api/tests/identity-access-management/acceptance/application/oidc-provider.route.test.js @@ -43,6 +43,7 @@ describe('Acceptance | Identity Access Management | Application | Route | oidc-p attributes: { code: 'OIDC_EXAMPLE_NET', 'organization-name': 'OIDC Example', + slug: 'oidc-example-net', 'should-close-session': true, source: 'oidcexamplenet', }, diff --git a/api/tests/identity-access-management/unit/application/oidc-provider.admin.controller.test.js b/api/tests/identity-access-management/unit/application/oidc-provider.admin.controller.test.js index 9badef4e234..44514589e66 100644 --- a/api/tests/identity-access-management/unit/application/oidc-provider.admin.controller.test.js +++ b/api/tests/identity-access-management/unit/application/oidc-provider.admin.controller.test.js @@ -132,6 +132,7 @@ describe('Unit | Identity Access Management | Application | Controller | Admin | attributes: { code: 'LIMONADE_OIDC_PROVIDER', 'organization-name': 'Limonade OIDC Provider', + slug: 'limonade-oidc-provider', 'should-close-session': false, source: 'limonade_oidc_provider', }, @@ -142,6 +143,7 @@ describe('Unit | Identity Access Management | Application | Controller | Admin | attributes: { code: 'KOMBUCHA_OIDC_PROVIDER', 'organization-name': 'Kombucha OIDC Provider', + slug: 'kombucha-oidc-provider', 'should-close-session': true, source: 'kombucha_oidc_provider', }, diff --git a/api/tests/identity-access-management/unit/application/oidc-provider.controller.test.js b/api/tests/identity-access-management/unit/application/oidc-provider.controller.test.js index 0a7322611f5..14a0ad22d00 100644 --- a/api/tests/identity-access-management/unit/application/oidc-provider.controller.test.js +++ b/api/tests/identity-access-management/unit/application/oidc-provider.controller.test.js @@ -262,6 +262,7 @@ describe('Unit | Identity Access Management | Application | Controller | oidc-pr code: 'SOME_OIDC_PROVIDER', source: 'some_oidc_provider', 'organization-name': 'Some OIDC Provider', + slug: 'some-oidc-provider', 'should-close-session': false, }, }); diff --git a/api/tests/identity-access-management/unit/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.test.js b/api/tests/identity-access-management/unit/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.test.js index 3a9666839ae..3f4fb1c1b4a 100644 --- a/api/tests/identity-access-management/unit/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.test.js +++ b/api/tests/identity-access-management/unit/infrastructure/serializers/jsonapi/oidc-identity-providers.serializer.test.js @@ -20,6 +20,7 @@ describe('Unit | Identity Access Management | Infrastructure | Serializer | JSON attributes: { code: 'OIDC_PARTNER', 'organization-name': 'Partenaire OIDC', + slug: 'oidc-partner', 'should-close-session': true, source: 'oidc-external', }, From bf2bf84d249da64b63f9d499c51745d8df8fcad5 Mon Sep 17 00:00:00 2001 From: LEGO Technix <109212476+lego-technix@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:09:35 +0200 Subject: [PATCH 2/5] feat(mon-pix): make available OIDC Providers slug from JSON API --- mon-pix/app/models/oidc-identity-provider.js | 1 + mon-pix/mirage/routes/authentication/oidc/index.js | 1 + .../components/authentication/login-or-register-oidc-test.js | 1 + 3 files changed, 3 insertions(+) diff --git a/mon-pix/app/models/oidc-identity-provider.js b/mon-pix/app/models/oidc-identity-provider.js index 92e52a85abb..c8101fc410a 100644 --- a/mon-pix/app/models/oidc-identity-provider.js +++ b/mon-pix/app/models/oidc-identity-provider.js @@ -3,6 +3,7 @@ import Model, { attr } from '@ember-data/model'; export default class OidcIdentityProvider extends Model { @attr() code; @attr() organizationName; + @attr() slug; @attr() shouldCloseSession; @attr() source; } diff --git a/mon-pix/mirage/routes/authentication/oidc/index.js b/mon-pix/mirage/routes/authentication/oidc/index.js index d1e452ce0a5..21ec09a973a 100644 --- a/mon-pix/mirage/routes/authentication/oidc/index.js +++ b/mon-pix/mirage/routes/authentication/oidc/index.js @@ -41,6 +41,7 @@ export default function (config) { attributes: { code: 'OIDC_PARTNER', 'organization-name': 'Partenaire OIDC', + slug: 'partenaire-oidc', 'should-close-session': false, source: 'oidc-externe', }, diff --git a/mon-pix/tests/integration/components/authentication/login-or-register-oidc-test.js b/mon-pix/tests/integration/components/authentication/login-or-register-oidc-test.js index 53ab4b8c710..150586316df 100644 --- a/mon-pix/tests/integration/components/authentication/login-or-register-oidc-test.js +++ b/mon-pix/tests/integration/components/authentication/login-or-register-oidc-test.js @@ -16,6 +16,7 @@ module('Integration | Component | authentication | login-or-register-oidc', func id: 'oidc-partner', code: 'OIDC_PARTNER', organizationName: 'Partenaire OIDC', + slug: 'partenaire-oidc', shouldCloseSession: false, source: 'oidc-externe', }; From d0725ad27069e07a0ec281bc920a40e5c4a7af9e Mon Sep 17 00:00:00 2001 From: LEGO Technix <109212476+lego-technix@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:50:19 +0200 Subject: [PATCH 3/5] feat(mon-pix): add featured identity provider and other identity providers in oidcIdentityProviders service --- .../app/services/oidc-identity-providers.js | 26 +++ .../services/oidc-identity-providers-test.js | 166 +++++++++++++++++- 2 files changed, 190 insertions(+), 2 deletions(-) diff --git a/mon-pix/app/services/oidc-identity-providers.js b/mon-pix/app/services/oidc-identity-providers.js index 558720e789a..3ac8ed4a938 100644 --- a/mon-pix/app/services/oidc-identity-providers.js +++ b/mon-pix/app/services/oidc-identity-providers.js @@ -1,8 +1,14 @@ import Service, { inject as service } from '@ember/service'; import isEmpty from 'lodash/isEmpty'; +// TODO: Manage this through the API +const FR_FEATURED_IDENTITY_PROVIDER_CODE = 'POLE_EMPLOI'; +const ORG_FEATURED_IDENTITY_PROVIDER_CODE = 'FWB'; +const FEATURED_IDENTITY_PROVIDER_CODES = [FR_FEATURED_IDENTITY_PROVIDER_CODE, ORG_FEATURED_IDENTITY_PROVIDER_CODE]; + export default class OidcIdentityProviders extends Service { @service store; + @service currentDomain; get list() { return this.store.peekAll('oidc-identity-provider'); @@ -15,6 +21,26 @@ export default class OidcIdentityProviders extends Service { .map((provider) => provider.organizationName); } + // TODO: Manage this through the API + get featuredIdentityProvider() { + return this.list.find((identityProvider) => { + const featuredIdentityProviderCode = this.currentDomain.isFranceDomain + ? FR_FEATURED_IDENTITY_PROVIDER_CODE + : ORG_FEATURED_IDENTITY_PROVIDER_CODE; + + return identityProvider.code === featuredIdentityProviderCode; + }); + } + + // TODO: Manage this through the API + get hasOtherIdentityProviders() { + if (!this.currentDomain.isFranceDomain) { + return false; + } + + return this.list.some((identityProvider) => !FEATURED_IDENTITY_PROVIDER_CODES.includes(identityProvider.code)); + } + isFwbActivated() { const identityProviderSlug = 'fwb'; const oidcIdentityProviders = this.list.filter((provider) => provider.id === identityProviderSlug); diff --git a/mon-pix/tests/unit/services/oidc-identity-providers-test.js b/mon-pix/tests/unit/services/oidc-identity-providers-test.js index bb078f7c666..622199cd89b 100644 --- a/mon-pix/tests/unit/services/oidc-identity-providers-test.js +++ b/mon-pix/tests/unit/services/oidc-identity-providers-test.js @@ -1,7 +1,7 @@ import Object from '@ember/object'; import Service from '@ember/service'; import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; +import { assert, module, test } from 'qunit'; import sinon from 'sinon'; module('Unit | Service | oidc-identity-providers', function (hooks) { @@ -14,6 +14,7 @@ module('Unit | Service | oidc-identity-providers', function (hooks) { id: 'oidc-partner', code: 'OIDC_PARTNER', organizationName: 'Partenaire OIDC', + slug: 'partenaire-oidc', shouldCloseSession: false, source: 'oidc-externe', }; @@ -29,7 +30,6 @@ module('Unit | Service | oidc-identity-providers', function (hooks) { await oidcIdentityProvidersService.load(); // then - assert.strictEqual(oidcIdentityProvidersService['oidc-partner'].code, oidcPartner.code); assert.strictEqual(oidcIdentityProvidersService['oidc-partner'].organizationName, oidcPartner.organizationName); assert.strictEqual( @@ -78,6 +78,168 @@ module('Unit | Service | oidc-identity-providers', function (hooks) { }); }); + module('featuredIdentityProvider', function () { + module('when there is some identity providers containing a featured one', function () { + test('returns the featured identity provider', async function () { + // given + const currentDomainService = this.owner.lookup('service:currentDomain'); + sinon.stub(currentDomainService, 'isFranceDomain').value(false); + + const oidcPartner = { + id: 'fwb', + code: 'FWB', + organizationName: 'FWB', + slug: 'fwb', + shouldCloseSession: false, + source: 'fwb', + }; + const oidcPartnerObject = Object.create(oidcPartner); + const storeStub = Service.create({ + peekAll: sinon.stub().returns([oidcPartnerObject]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const featuredIdentityProvider = await oidcIdentityProvidersService.featuredIdentityProvider; + + // then + assert.strictEqual(featuredIdentityProvider.id, oidcPartner.id); + assert.strictEqual(featuredIdentityProvider.code, oidcPartner.code); + assert.strictEqual(featuredIdentityProvider.organizationName, oidcPartner.organizationName); + assert.strictEqual(featuredIdentityProvider.slug, oidcPartner.slug); + assert.strictEqual(featuredIdentityProvider.shouldCloseSession, oidcPartner.shouldCloseSession); + assert.strictEqual(featuredIdentityProvider.source, oidcPartner.source); + }); + }); + + module('when there is some identity providers but no featured one', function () { + test('returns undefined', async function () { + // given + const oidcPartner = { + id: 'oidc-partner', + code: 'OIDC_PARTNER', + organizationName: 'Partenaire OIDC', + slug: 'partenaire-oidc', + shouldCloseSession: false, + source: 'oidc-externe', + }; + const oidcPartnerObject = Object.create(oidcPartner); + const storeStub = Service.create({ + peekAll: sinon.stub().returns([oidcPartnerObject]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const featuredIdentityProvider = await oidcIdentityProvidersService.featuredIdentityProvider; + + // then + assert.strictEqual(featuredIdentityProvider, undefined); + }); + }); + + module('when there isn’t any identity providers', function () { + test('returns undefined', async function () { + // given + const storeStub = Service.create({ + peekAll: sinon.stub().returns([]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const featuredIdentityProvider = await oidcIdentityProvidersService.featuredIdentityProvider; + + // then + assert.strictEqual(featuredIdentityProvider, undefined); + }); + }); + }); + + module('hasOtherIdentityProviders', function () { + module('when in France domain', function (hooks) { + hooks.beforeEach(function () { + const currentDomainService = this.owner.lookup('service:currentDomain'); + sinon.stub(currentDomainService, 'isFranceDomain').value(true); + }); + + module('when there is some other identity providers', function () { + test('returns true', async function () { + // given + const oidcPartner = { + id: 'oidc-partner', + code: 'OIDC_PARTNER', + organizationName: 'Partenaire OIDC', + slug: 'partenaire-oidc', + shouldCloseSession: false, + source: 'oidc-externe', + }; + const oidcPartnerObject = Object.create(oidcPartner); + const storeStub = Service.create({ + peekAll: sinon.stub().returns([oidcPartnerObject]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const hasOtherIdentityProviders = await oidcIdentityProvidersService.hasOtherIdentityProviders; + + // then + assert.strictEqual(hasOtherIdentityProviders, true); + }); + }); + + module('when there isn’t any other identity providers', function () { + test('returns false', async function () { + // given + const storeStub = Service.create({ + peekAll: sinon.stub().returns([]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const hasOtherIdentityProviders = await oidcIdentityProvidersService.hasOtherIdentityProviders; + + // then + assert.strictEqual(hasOtherIdentityProviders, false); + }); + }); + }); + + module('when not in France domain', function (hooks) { + hooks.beforeEach(function () { + const currentDomainService = this.owner.lookup('service:currentDomain'); + sinon.stub(currentDomainService, 'isFranceDomain').value(false); + }); + + test('returns false', async function () { + // given + const oidcPartner = { + id: 'oidc-partner', + code: 'OIDC_PARTNER', + organizationName: 'Partenaire OIDC', + slug: 'partenaire-oidc', + shouldCloseSession: false, + source: 'oidc-externe', + }; + const oidcPartnerObject = Object.create(oidcPartner); + const storeStub = Service.create({ + peekAll: sinon.stub().returns([oidcPartnerObject]), + }); + const oidcIdentityProvidersService = this.owner.lookup('service:oidcIdentityProviders'); + oidcIdentityProvidersService.set('store', storeStub); + + // when + const hasOtherIdentityProviders = await oidcIdentityProvidersService.hasOtherIdentityProviders; + + // then + assert.strictEqual(hasOtherIdentityProviders, false); + }); + }); + }); + module('isFwbActivated', function () { test('returns true when identity provider is activated', function (assert) { // given From c891277339d705c935db1f5739f0210463599745 Mon Sep 17 00:00:00 2001 From: LEGO Technix <109212476+lego-technix@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:52:34 +0200 Subject: [PATCH 4/5] feat(mon-pix): add new component authentication/other-authentication-providers --- .../other-authentication-providers.gjs | 57 +++++++ .../other-authentication-providers.scss | 36 +++++ mon-pix/app/styles/app.scss | 1 + .../images/logo/pole-emploi-connect-logo.svg | 12 ++ .../other-authentication-providers-test.gjs | 149 ++++++++++++++++++ mon-pix/translations/en.json | 6 + mon-pix/translations/es.json | 6 + mon-pix/translations/fr.json | 6 + mon-pix/translations/nl.json | 6 + 9 files changed, 279 insertions(+) create mode 100644 mon-pix/app/components/authentication/other-authentication-providers.gjs create mode 100644 mon-pix/app/components/authentication/other-authentication-providers.scss create mode 100644 mon-pix/public/images/logo/pole-emploi-connect-logo.svg create mode 100644 mon-pix/tests/integration/components/authentication/other-authentication-providers-test.gjs diff --git a/mon-pix/app/components/authentication/other-authentication-providers.gjs b/mon-pix/app/components/authentication/other-authentication-providers.gjs new file mode 100644 index 00000000000..0083f875a71 --- /dev/null +++ b/mon-pix/app/components/authentication/other-authentication-providers.gjs @@ -0,0 +1,57 @@ +import PixButtonLink from '@1024pix/pix-ui/components/pix-button-link'; +import { service } from '@ember/service'; +import Component from '@glimmer/component'; +import { t } from 'ember-intl'; + +export default class OtherAuthenticationProviders extends Component { + @service oidcIdentityProviders; + @service router; + + +} diff --git a/mon-pix/app/components/authentication/other-authentication-providers.scss b/mon-pix/app/components/authentication/other-authentication-providers.scss new file mode 100644 index 00000000000..7dc7a34b734 --- /dev/null +++ b/mon-pix/app/components/authentication/other-authentication-providers.scss @@ -0,0 +1,36 @@ +.authentication-other-authentication-providers-section { + display: flex; + flex-direction: column; + gap: var(--pix-spacing-4x); + + &__heading { + display: flex; + gap: var(--pix-spacing-6x); + margin-top: var(--pix-spacing-10x); + margin-bottom: var(--pix-spacing-10x); + color: var(--pix-neutral-500); + } + + &__heading::before, + &__heading::after { + flex: 1 1; + margin: auto; + border-bottom: 1px solid var(--pix-neutral-100); + content: ""; + } + + &__button-link { + border: 1px solid; + } + + &__featured-identity-provider-logo { + width: var(--pix-spacing-6x); + margin-right: var(--pix-spacing-4x); + } + + // TODO: Use @iconAfter="chevronRight" when possible + &__chevron-right { + padding-left: var(--pix-spacing-6x); + font-weight: 1000; + } +} \ No newline at end of file diff --git a/mon-pix/app/styles/app.scss b/mon-pix/app/styles/app.scss index ff43c8a74c5..5433a278407 100644 --- a/mon-pix/app/styles/app.scss +++ b/mon-pix/app/styles/app.scss @@ -137,6 +137,7 @@ of an adaptative/mobile-first approach — refactoring is welcome here */ @import 'authentication/oidc-provider-selector'; @import 'authentication/signin-form'; @import 'authentication/sso-selection-form'; +@import 'authentication/other-authentication-providers'; @import 'authentication/password-input/password-checklist'; @import 'authentication/password-input/password-rule'; diff --git a/mon-pix/public/images/logo/pole-emploi-connect-logo.svg b/mon-pix/public/images/logo/pole-emploi-connect-logo.svg new file mode 100644 index 00000000000..c020b1e4132 --- /dev/null +++ b/mon-pix/public/images/logo/pole-emploi-connect-logo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/mon-pix/tests/integration/components/authentication/other-authentication-providers-test.gjs b/mon-pix/tests/integration/components/authentication/other-authentication-providers-test.gjs new file mode 100644 index 00000000000..7cbdb5291f2 --- /dev/null +++ b/mon-pix/tests/integration/components/authentication/other-authentication-providers-test.gjs @@ -0,0 +1,149 @@ +import { render } from '@1024pix/ember-testing-library'; +import Service from '@ember/service'; +import { t } from 'ember-intl/test-support'; +import OtherAuthenticationProviders from 'mon-pix/components/authentication/other-authentication-providers'; +import { module, test } from 'qunit'; + +import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering'; + +module('Integration | Component | Authentication | other-authentication-providers', function (hooks) { + setupIntlRenderingTest(hooks); + + module('when it’s for login', function () { + test('it displays a login heading', async function (assert) { + // when + const screen = await render(); + + // then + assert + .dom( + screen.getByRole('heading', { + name: t('components.authentication.other-authentication-providers.login-heading'), + }), + ) + .exists(); + }); + }); + + module('when it’s for signup', function () { + test('it displays a signup heading', async function (assert) { + // when + const screen = await render(); + + // then + assert + .dom( + screen.getByRole('heading', { + name: t('components.authentication.other-authentication-providers.signup-heading'), + }), + ) + .exists(); + }); + }); + + module('when there is a featured identity provider', function () { + test('it displays a continue featured identity provider link', async function (assert) { + // given + class OidcIdentityProvidersServiceStub extends Service { + get featuredIdentityProvider() { + return { organizationName: 'Some Identity Provider', slug: 'some-identity-provider' }; + } + } + this.owner.register('service:oidcIdentityProviders', OidcIdentityProvidersServiceStub); + + // when + const screen = await render(); + + // then + const link = await screen.findByRole('link', { + name: t( + 'components.authentication.other-authentication-providers.continue-with-featured-identity-provider-link', + { + featuredIdentityProvider: 'Some Identity Provider', + }, + ), + }); + assert.dom(link).exists(); + assert.strictEqual(link.getAttribute('href'), '/connexion/some-identity-provider'); + }); + }); + + module('when there isn’t any featured identity provider', function () { + test('it doesn’t display a continue featured identity provider link', async function (assert) { + // given + class OidcIdentityProvidersServiceStub extends Service { + get featuredIdentityProvider() { + return null; + } + } + this.owner.register('service:oidcIdentityProviders', OidcIdentityProvidersServiceStub); + + // when + const screen = await render(); + + // then + assert + .dom( + screen.queryByText( + t( + 'components.authentication.other-authentication-providers.continue-with-featured-identity-provider-link', + { + featuredIdentityProvider: 'Some Identity Provider', + }, + ), + ), + ) + .doesNotExist(); + }); + }); + + module('when there are other identity providers', function () { + test('it displays a select another organization link', async function (assert) { + // given + class OidcIdentityProvidersServiceStub extends Service { + get hasOtherIdentityProviders() { + return true; + } + + load() { + return Promise.resolve(); + } + } + this.owner.register('service:oidcIdentityProviders', OidcIdentityProvidersServiceStub); + + // when + const screen = await render(); + + // then + const link = await screen.findByRole('link', { + name: t('components.authentication.other-authentication-providers.select-another-organization-link'), + }); + assert.dom(link).exists(); + assert.strictEqual(link.getAttribute('href'), '/connexion/sso-selection'); + }); + }); + + module('when there aren’t any other identity providers', function () { + test('it doesn’t display a select another organization link', async function (assert) { + // given + class OidcIdentityProvidersServiceStub extends Service { + get hasOtherIdentityProviders() { + return false; + } + } + this.owner.register('service:oidcIdentityProviders', OidcIdentityProvidersServiceStub); + + // when + const screen = await render(); + + // then + assert + .dom( + screen.queryByText( + t('components.authentication.other-authentication-providers.select-another-organization-link'), + ), + ) + .doesNotExist(); + }); + }); +}); diff --git a/mon-pix/translations/en.json b/mon-pix/translations/en.json index 2d62350a173..10f994eda2c 100644 --- a/mon-pix/translations/en.json +++ b/mon-pix/translations/en.json @@ -125,6 +125,12 @@ "placeholder": "Select an organization", "searchLabel": "Keyword search" }, + "other-authentication-providers": { + "signup-heading": "Other ways to sign up", + "login-heading": "Other ways to log in", + "continue-with-featured-identity-provider-link": "Continue with {featuredIdentityProvider}", + "select-another-organization-link": "Choose another organisation" + }, "password-input": { "error-message": "You have entered the wrong password. Your password must be longer than 8 characters and contain at least one number, one lower case letter and one upper case letter.", "instructions-label": "Your password must comply with the following rules:", diff --git a/mon-pix/translations/es.json b/mon-pix/translations/es.json index 1f77d485772..114c432fe9c 100644 --- a/mon-pix/translations/es.json +++ b/mon-pix/translations/es.json @@ -118,6 +118,12 @@ "placeholder": "Select an organization", "searchLabel": "Keyword search" }, + "other-authentication-providers": { + "signup-heading": "Other ways to sign up", + "login-heading": "Other ways to log in", + "continue-with-featured-identity-provider-link": "Continue with {featuredIdentityProvider}", + "select-another-organization-link": "Choose another organisation" + }, "password-input": { "error-message": "You have entered the wrong password. Your password must be longer than 8 characters and contain at least one number, one lower case letter and one upper case letter.", "instructions-label": "Your password must comply with the following rules:", diff --git a/mon-pix/translations/fr.json b/mon-pix/translations/fr.json index f9eb621532c..b08126b060d 100644 --- a/mon-pix/translations/fr.json +++ b/mon-pix/translations/fr.json @@ -125,6 +125,12 @@ "placeholder": "Sélectionner un organisme", "searchLabel": "Recherche par mots-clés" }, + "other-authentication-providers": { + "signup-heading": "Autres moyens d’inscription", + "login-heading": "Autres moyens de connexion", + "continue-with-featured-identity-provider-link": "Continuer avec {featuredIdentityProvider}", + "select-another-organization-link": "Choisir une autre organisation" + }, "password-input": { "error-message": "Le mot de passe saisi est erroné. Votre mot de passe doit être supérieur à 8 caractères et contenir au minimum un chiffre, une minuscule et une majuscule.", "instructions-label": "Votre mot de passe doit respecter les règles suivantes :", diff --git a/mon-pix/translations/nl.json b/mon-pix/translations/nl.json index f23376c21b1..b791c38ac2d 100644 --- a/mon-pix/translations/nl.json +++ b/mon-pix/translations/nl.json @@ -118,6 +118,12 @@ "placeholder": "Select an organization", "searchLabel": "Keyword search" }, + "other-authentication-providers": { + "signup-heading": "Other ways to sign up", + "login-heading": "Other ways to log in", + "continue-with-featured-identity-provider-link": "Continue with {featuredIdentityProvider}", + "select-another-organization-link": "Choose another organisation" + }, "password-input": { "error-message": "You have entered the wrong password. Your password must be longer than 8 characters and contain at least one number, one lower case letter and one upper case letter.", "instructions-label": "Your password must comply with the following rules:", From 434311af8c0d41d68c56573413c91c0f3033216d Mon Sep 17 00:00:00 2001 From: LEGO Technix <109212476+lego-technix@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:56:51 +0200 Subject: [PATCH 5/5] feat(mon-pix): use new component authentication/other-authentication-providers --- mon-pix/app/templates/authentication/login.hbs | 1 + 1 file changed, 1 insertion(+) diff --git a/mon-pix/app/templates/authentication/login.hbs b/mon-pix/app/templates/authentication/login.hbs index 908124b7982..af669724611 100644 --- a/mon-pix/app/templates/authentication/login.hbs +++ b/mon-pix/app/templates/authentication/login.hbs @@ -11,6 +11,7 @@ <:content>

{{t "pages.sign-in.first-title"}}

+ {{else}}