Skip to content

Commit

Permalink
Merge pull request #9246 from CitizenLabDotCo/master
Browse files Browse the repository at this point in the history
 Release 2024-10-29
  • Loading branch information
EdwinKato authored Oct 29, 2024
2 parents 0903a33 + 2033261 commit 8b532ab
Show file tree
Hide file tree
Showing 46 changed files with 318 additions and 140 deletions.
2 changes: 1 addition & 1 deletion back/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.3.7)
rexml (3.3.9)
rgeo (3.0.1)
rgeo-activerecord (7.0.1)
activerecord (>= 5.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ def locked_attributes
def locked_custom_fields
[]
end

def enabled_for_verified_actions?
config[:enabled_for_verified_actions] || false
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def name
'criipto'
end

def ui_method_name
config[:ui_method_name].presence || name
end

def name_for_hashing
config[:method_name_for_hashing].presence || config[:identity_source].presence || super
end
Expand All @@ -36,6 +40,7 @@ def config_parameters
uid_field_pattern
method_name_for_hashing
minimum_age
enabled_for_verified_actions
]
end

Expand Down Expand Up @@ -82,6 +87,11 @@ def config_parameters_schema
private: true,
type: 'integer',
description: 'Minimum age required to verify (in years). No value means no age minimum.'
},
enabled_for_verified_actions: {
private: true,
type: 'boolean',
description: 'Whether this verification method should be enabled for verified actions.'
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ def updateable_user_attrs
super + %i[first_name last_name]
end

def enabled_for_verified_actions?
config[:enabled_for_verified_actions] || false
end

def ui_method_name
config[:ui_method_name] || name
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ def check_entitled_on_sso?
true
end

def enabled_for_verified_actions?
config[:enabled_for_verified_actions] || false
end

def ui_method_name
'NemLog-in'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ def config
.symbolize_keys
.presence
end

def enabled_for_verified_actions?
config[:enabled_for_verified_actions] || false
end
end
end
2 changes: 1 addition & 1 deletion back/engines/free/email_campaigns/config/locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ de:
title_basket_submitted: 'Sie haben erfolgreich abgestimmt'
event_description: 'Vielen Dank für Ihre Teilnahme. Ihre Stimmen wurden aufgezeichnet. Besuchen Sie die Plattform von %{organizationName}, um Ihre Stimmen zu sehen und zu verwalten.'
cta_see_votes_submitted: 'Siehe abgegebene Stimmen'
cta_message: 'Klicken Sie auf die Schaltfläche unten, um teilzunehmen'
cta_message: 'Klicken Sie auf den Button unten, um teilzunehmen'
native_survey_not_submitted:
subject: '%{organizationName}: Fast geschafft! Reichen Sie Ihre Antworten ein'
preheader: 'Sie haben Ihre Umfrageantwort nicht auf der Teilnahmeplattform von %{organizationName}ausgefüllt.'
Expand Down
3 changes: 3 additions & 0 deletions front/app/component-library/components/IconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const StyledBox = styled(Box)<{

export type IconButtonProps = {
className?: string;
id?: string;
iconName: IconNames;
// Provide a description that describes the button's task
// E.g. close idea page modal
Expand All @@ -68,6 +69,7 @@ export type IconButtonProps = {

const IconButton = ({
className,
id,
iconName,
onClick,
a11y_buttonActionMessage,
Expand All @@ -88,6 +90,7 @@ const IconButton = ({
<StyledBox
as="button"
className={className ?? ''}
id={id}
onClick={onClick}
iconColorOnHover={iconColorOnHover}
aria-expanded={ariaExpanded}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('<ConsentManager />', () => {
});
});

it('rejects all cookies except functional if preference modal is openend and confirmed without changes', () => {
it('rejects all cookies except functional if preference modal is opened and confirmed without changes', () => {
const { container } = render(<ConsentManager />);
fireEvent.click(container.querySelector('.integration-open-modal'));
fireEvent.click(container.querySelector('#e2e-preferences-save'));
Expand Down
32 changes: 22 additions & 10 deletions front/app/components/ConsentManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ const ConsentManager = () => {
const { data: appConfiguration } = useAppConfiguration();
const { data: authUser } = useAuthUser();

useEffect(() => {
const cookieConsent = getConsent();
setCookieConsent(cookieConsent);

eventEmitter.emit<ISavedDestinations>(
'destinationConsentChanged',
cookieConsent?.savedChoices || {}
);
}, []);

const resetPreferences = useCallback(() => {
setPreferences(
getCurrentPreferences(
Expand All @@ -54,6 +44,28 @@ const ConsentManager = () => {
);
}, [appConfiguration, authUser, cookieConsent]);

useEffect(() => {
const cookieConsent = getConsent();
setCookieConsent(cookieConsent);

const defaultPreferences = getCurrentPreferences(
appConfiguration?.data,
authUser?.data,
cookieConsent
);

if (defaultPreferences.functional === undefined) {
defaultPreferences.functional = true;
}

setPreferences(defaultPreferences);

eventEmitter.emit<ISavedDestinations>(
'destinationConsentChanged',
cookieConsent?.savedChoices || {}
);
}, [appConfiguration?.data, authUser?.data]);

const updatePreference = useCallback(
(category: TCategory, value: boolean) => {
setPreferences((preferences) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const GoBackButton = ({ onClick }: Props) => {
return (
<IconButton
data-testid="goBackButton"
id="e2e-go-back-button"
iconName="arrow-left"
buttonType="button"
iconColor={colors.textSecondary}
Expand Down
2 changes: 1 addition & 1 deletion front/app/containers/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const SkipLinkStyled = styled.a`
background: ${colors.black};
color: ${colors.white};
padding: 8px;
z-index: 1000;
z-index: 10000;
text-align: center;
text-decoration: none;
&:focus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import claveUnicaButtonMessages from 'components/UI/ClaveUnicaButton/messages';

import { FormattedMessage } from 'utils/cl-intl';

import NemlogInButton from '../_components/NemLogInButton';
import MitIdButton from '../_components/MitIdButton';
import TextButton from '../_components/TextButton';
import AuthProviderButton from '../AuthProviders/AuthProviderButton';
import authProviderMessages from '../AuthProviders/messages';
Expand All @@ -33,11 +33,12 @@ const SSOVerification = ({ onClickSSO, onClickLogin }: Props) => {
const isNemLogIn = verificationMethod.data.attributes.name === 'nemlog_in';
const isClaveUnica =
verificationMethod.data.attributes.name === 'clave_unica';
const isCriipto = verificationMethod.data.attributes.name === 'criipto';

return (
<Box>
{isNemLogIn && (
<NemlogInButton
<MitIdButton
last={false}
grayBorder
standardSSOBehavior
Expand All @@ -46,6 +47,16 @@ const SSOVerification = ({ onClickSSO, onClickLogin }: Props) => {
}}
/>
)}
{isCriipto && (
<MitIdButton
last={false}
grayBorder
standardSSOBehavior
onClickStandardSSO={() => {
onClickSSO('criipto');
}}
/>
)}
{isClaveUnica && (
<ClaveUnicaButton
disabled={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Props {
onClickStandardSSO?: () => void;
}

const NemlogInButton = ({
const MitIdButton = ({
method,
last,
grayBorder,
Expand All @@ -40,9 +40,9 @@ const NemlogInButton = ({
onClickStandardSSO?.();
} else {
const jwt = getJwt();
window.location.href = `${AUTH_PATH}/nemlog_in?token=${jwt}&pathname=${removeUrlLocale(
window.location.pathname
)}`;
window.location.href = `${AUTH_PATH}/${
method?.attributes.name
}?token=${jwt}&pathname=${removeUrlLocale(window.location.pathname)}`;
}
};

Expand All @@ -52,9 +52,9 @@ const NemlogInButton = ({
onClick={handleOnClick}
borderColor={grayBorder ? colors.grey500 : undefined}
>
<FormattedMessage {...messages.verifyNemLogIn} />
<FormattedMessage {...messages.verifyMitId} />
</VerificationMethodButton>
);
};

export default NemlogInButton;
export default MitIdButton;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineMessages } from 'react-intl';

export default defineMessages({
verifyNemLogIn: {
verifyMitId: {
id: 'app.components.VerificationModal.verifyNemLogIn',
defaultMessage: 'Verify with MitID',
},
Expand Down

This file was deleted.

19 changes: 6 additions & 13 deletions front/app/modules/commercial/id_criipto/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import React from 'react';

import {
IDCriiptoMethod,
TVerificationMethodName,
} from 'api/verification_methods/types';
import { TVerificationMethodName } from 'api/verification_methods/types';
import { isLastVerificationMethod } from 'api/verification_methods/util';

import { ModuleConfiguration } from 'utils/moduleUtils';

import CriiptoButton from './components/CriiptoButton';
const MitIdButton = React.lazy(
() => import('containers/Authentication/steps/_components/MitIdButton')
);

const verificationMethodName: TVerificationMethodName = 'criipto';
const configuration: ModuleConfiguration = {
outlets: {
'app.components.VerificationModal.buttons': ({
verificationMethods,
...props
...otherProps
}) => {
const method = verificationMethods.find(
(vm) => vm.attributes.name === verificationMethodName
Expand All @@ -26,13 +25,7 @@ const configuration: ModuleConfiguration = {
verificationMethodName,
verificationMethods
);
return (
<CriiptoButton
verificationMethod={method as IDCriiptoMethod}
last={last}
{...props}
/>
);
return <MitIdButton last={last} method={method} {...otherProps} />;
}

return null;
Expand Down
6 changes: 3 additions & 3 deletions front/app/modules/commercial/id_nemlog_in/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { isLastVerificationMethod } from 'api/verification_methods/util';

import { ModuleConfiguration } from 'utils/moduleUtils';

const NemlogInButton = React.lazy(
() => import('containers/Authentication/steps/_components/NemLogInButton')
const MitIdButton = React.lazy(
() => import('containers/Authentication/steps/_components/MitIdButton')
);

const verificationMethodName: TVerificationMethodName = 'nemlog_in';
Expand All @@ -25,7 +25,7 @@ const configuration: ModuleConfiguration = {
verificationMethodName,
verificationMethods
);
return <NemlogInButton last={last} method={method} {...otherProps} />;
return <MitIdButton last={last} method={method} {...otherProps} />;
}

return null;
Expand Down
2 changes: 0 additions & 2 deletions front/app/translations/ach-UG.json
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,6 @@
"app.containers.AdminPage.ProjectDescription.saveError": "crwdns3106613:0crwdne3106613:0",
"app.containers.AdminPage.ProjectDescription.toggleLabel": "crwdns3106615:0crwdne3106615:0",
"app.containers.AdminPage.ProjectDescription.toggleTooltip": "crwdns3106617:0crwdne3106617:0",
"app.containers.AdminPage.ProjectDescription.viewProject": "crwdns3106619:0crwdne3106619:0",
"app.containers.AdminPage.ProjectDescription.viewPublicProject": "crwdns3106621:0crwdne3106621:0",
"app.containers.AdminPage.ProjectEdit.formBuilder.surveyEnd": "crwdns214168:0crwdne214168:0",
"app.containers.AdminPage.Users.GroupCreation.modalHeaderRules": "crwdns214170:0crwdne214170:0",
Expand Down Expand Up @@ -1807,7 +1806,6 @@
"app.containers.admin.ContentBuilder.infoWithAccordions": "crwdns3106629:0crwdne3106629:0",
"app.containers.admin.ContentBuilder.oneColumnLayout": "crwdns3106631:0crwdne3106631:0",
"app.containers.admin.ContentBuilder.projectDescription": "crwdns3106633:0crwdne3106633:0",
"app.containers.admin.ContentBuilder.sections": "crwdns3106635:0crwdne3106635:0",
"app.containers.app.navbar.admin": "crwdns215692:0crwdne215692:0",
"app.containers.app.navbar.allProjects": "crwdns215694:0crwdne215694:0",
"app.containers.app.navbar.ariaLabel": "crwdns215696:0crwdne215696:0",
Expand Down
Loading

0 comments on commit 8b532ab

Please sign in to comment.