@aarhus-university/au-lib-react-components 9.11.18 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +44 -0
- package/README.md +19 -20
- package/babel.config.js +7 -6
- package/build/umd/all.css +1 -1
- package/build/umd/all.css.map +1 -1
- package/build/umd/all.js +1 -1
- package/build/umd/all.js.map +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/alphabox.js.map +1 -1
- package/build/umd/databox.js +1 -2
- package/build/umd/databox.js.map +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/diagramme.js.map +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/flowbox.js.map +1 -1
- package/build/umd/universe.js +1 -1
- package/build/umd/universe.js.map +1 -1
- package/package.json +66 -60
- package/src/components/{delphinus/AUAlertComponent.js → AUAlertComponent.tsx} +70 -85
- package/src/components/{AutoSuggestComponent.js → AUAutoSuggestComponent.js} +45 -19
- package/src/components/AUCalendarComponent.tsx +493 -0
- package/src/components/AUContentToggleComponent.tsx +33 -0
- package/src/components/AUDatepickerComponent.tsx +117 -0
- package/src/components/AUMobilePrefixComponent.tsx +15 -0
- package/src/components/{delphinus/AUModalComponent.js → AUModalComponent.tsx} +80 -94
- package/src/components/{form/AUReceiptComponent.js → AUReceiptComponent.tsx} +33 -40
- package/src/components/AUSpinnerComponent.tsx +67 -0
- package/src/components/{delphinus/AUSubNavComponent.js → AUSubNavComponent.tsx} +38 -53
- package/src/components/{form/AUSubmitButtonContainerComponent.js → AUSubmitButtonContainerComponent.tsx} +31 -39
- package/src/components/{delphinus/AUTabbedContentComponent.js → AUTabbedContentComponent.tsx} +145 -150
- package/src/components/{delphinus/AUTableComponent.js → AUTableComponent.tsx} +24 -28
- package/src/components/{delphinus/AUToastComponent.js → AUToastComponent.tsx} +104 -91
- package/src/components/{delphinus/AUToolbarComponent.js → AUToolbarComponent.tsx} +45 -48
- package/src/components/profile/AUProfileActions.js +128 -128
- package/src/components/profile/AUProfileAvatarComponent.js +83 -83
- package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
- package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -0
- package/src/components/profile/AUProfileContainerComponent.js +283 -283
- package/src/components/profile/AUProfileHooks.js +30 -30
- package/src/components/profile/AUProfileItemComponent.js +54 -54
- package/src/components/profile/AUProfileLanguageComponent.js +131 -131
- package/src/components/profile/{AUProfileLoginComponent.js → AUProfileLoginComponent.tsx} +3 -18
- package/src/components/profile/AUProfileMailComponent.js +307 -307
- package/src/components/profile/AUProfileMobileComponent.js +164 -164
- package/src/components/profile/AUProfileNameComponent.js +253 -253
- package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
- package/src/components/profile/AUProfileReducer.js +230 -230
- package/src/components/profile/AUProfileWidgetComponent.js +95 -95
- package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
- package/src/components/profile/{AUProfileWidgetV3Component.js → AUProfileWidgetV3Component.tsx} +122 -130
- package/src/components/wrapping/AUEmbedComponent.js +47 -47
- package/src/{components → layout-2016/components}/alphabox/AlphaBoxComponent.js +28 -25
- package/src/{components → layout-2016/components}/alphabox/AlphaBoxContentComponent.js +25 -14
- package/src/{components → layout-2016/components/common}/AUCollapsibleComponent.js +1 -22
- package/src/{components → layout-2016/components/common}/AUSpinnerComponent.js +2 -24
- package/src/{components → layout-2016/components}/databox/DataBoxAlphabetComponent.js +1 -1
- package/src/{components → layout-2016/components}/databox/DataBoxAssociationComponent.js +2 -2
- package/src/{components → layout-2016/components}/databox/DataBoxButtonComponent.js +7 -3
- package/src/{components → layout-2016/components}/databox/DataBoxComponent.js +2 -2
- package/src/{components → layout-2016/components}/databox/DataBoxGroupingComponent.js +2 -0
- package/src/{components → layout-2016/components}/databox/DataBoxSearchResultComponent.js +1 -5
- package/src/{components → layout-2016/components}/databox/DataBoxStackedAssociationComponent.js +1 -5
- package/src/{components → layout-2016/components}/databox/DataBoxSuggestionComponent.js +0 -0
- package/src/{components → layout-2016/components/diagramme}/AUDiagrammeComponent.js +5 -6
- package/src/{components → layout-2016/components}/flowbox/FlowBoxComponent.js +8 -8
- package/src/{components → layout-2016/components}/flowbox/FlowBoxPhoneComponent.js +3 -5
- package/src/{components → layout-2016/components}/profile/AUProfileAvatar2016Component.js +6 -2
- package/src/{components → layout-2016/components}/universe/StaffTopComponent.js +4 -3
- package/src/{components → layout-2016/components}/universe/StudentTopComponent.js +0 -0
- package/src/{components → layout-2016/components}/universe/UniverseContainerComponent.js +11 -8
- package/src/layout-2016/lib/all.js +3 -0
- package/src/{lib → layout-2016/lib}/au-alphabox.js +1 -3
- package/src/{lib → layout-2016/lib}/au-databox.js +6 -9
- package/src/{lib → layout-2016/lib}/au-diagramme.js +2 -4
- package/src/{lib → layout-2016/lib}/au-flowbox.js +1 -3
- package/src/{lib → layout-2016/lib}/universe.js +0 -0
- package/src/lib/{helpers.js → helpers.ts} +33 -58
- package/src/{components/delphinus/hooks.js → lib/hooks.ts} +33 -28
- package/src/lib/{i18n.js → i18n.ts} +600 -601
- package/src/lib/{tracking.js → tracking.ts} +69 -65
- package/src/lib/{wrapping.js → wrapping.ts} +21 -16
- package/src/styles/_settings.scss +10 -10
- package/src/styles/alphabox.scss +222 -208
- package/src/styles/app.scss +7 -13
- package/src/styles/autosuggest.scss +57 -57
- package/src/styles/databox.scss +563 -563
- package/src/styles/diagramme.scss +119 -119
- package/src/styles/flowbox.scss +72 -72
- package/src/styles/maps.scss +395 -395
- package/tsconfig.json +47 -0
- package/types/common/interfaces/gui.d.ts +52 -0
- package/types/common/interfaces/model.d.ts +29 -0
- package/types/common/main.d.ts +5 -0
- package/types/common/package.json +5 -0
- package/types/common/payloads.d.ts +0 -0
- package/types/common/props.d.ts +165 -0
- package/{src/config/webpack.umd.config.js → webpack.config.js} +20 -16
- package/.eslintrc +0 -19
- package/build/dev.html +0 -329
- package/build/umd/auAuth.js +0 -2
- package/build/umd/auAuth.js.map +0 -1
- package/build/umd/databox.js.LICENSE.txt +0 -5
- package/build/umd/news.js +0 -2
- package/build/umd/news.js.map +0 -1
- package/src/all.js +0 -3
- package/src/app.js +0 -263
- package/src/components/AUAlertComponent.js +0 -158
- package/src/components/AUAmountComponent.js +0 -84
- package/src/components/AUBannerComponent.js +0 -99
- package/src/components/AUCalendarComponent.js +0 -393
- package/src/components/AUDatepickerComponent.js +0 -105
- package/src/components/AUFilterCheckboxComponent.js +0 -122
- package/src/components/AUFocusComponent.js +0 -55
- package/src/components/AUModalComponent.js +0 -94
- package/src/components/AUPaginationComponent.js +0 -103
- package/src/components/context/AUUserContextComponent.js +0 -91
- package/src/components/context/ImpersonateComponent.js +0 -54
- package/src/components/delphinus/AUCalendarComponent.js +0 -487
- package/src/components/delphinus/AUContentToggleComponent.js +0 -32
- package/src/components/delphinus/AUDatepickerComponent.js +0 -164
- package/src/components/delphinus/AULoginComponent.js +0 -65
- package/src/components/delphinus/AUSpinnerComponent.js +0 -114
- package/src/components/form/AUMobilePrefixComponent.js +0 -18
- package/src/components/news/EventLayout1Component.js +0 -94
- package/src/components/news/EventLayout2Component.js +0 -90
- package/src/components/news/EventLayout3Component.js +0 -68
- package/src/components/news/NewsCategoriesComponent.js +0 -21
- package/src/components/news/NewsCollageBannerComponent.js +0 -71
- package/src/components/news/NewsCollageBannerRSSComponent.js +0 -79
- package/src/components/news/NewsColumnsComponent.js +0 -125
- package/src/components/news/NewsLanguageChangeComponent.js +0 -74
- package/src/components/news/NewsLayout1Component.js +0 -80
- package/src/components/news/NewsLayout2Component.js +0 -80
- package/src/components/news/NewsLayout3Component.js +0 -81
- package/src/components/news/NewsLayout4Component.js +0 -80
- package/src/components/news/NewsLayout5Component.js +0 -61
- package/src/components/news/NewsLayout6Component.js +0 -55
- package/src/components/news/NewsLayout7Component.js +0 -58
- package/src/components/news/NewsLayout8Component.js +0 -57
- package/src/components/news/NewsListComponent.js +0 -291
- package/src/components/news/NewsPopUpComponent.js +0 -591
- package/src/components/news/NewsRSSComponent.js +0 -74
- package/src/components/news/NewsSocialComponent.js +0 -104
- package/src/components/news/NewsSubHeaderComponent.js +0 -19
- package/src/components/password/AUChangePasswordComponent.js +0 -177
- package/src/components/password/AUCurrentPasswordComponent.js +0 -72
- package/src/components/password/AUNewPasswordComponent.js +0 -143
- package/src/components/password/AUPasswordActions.js +0 -101
- package/src/components/password/AUPasswordHooks.js +0 -47
- package/src/components/password/AUPasswordReducer.js +0 -78
- package/src/components/password/AUPasswordRequirementsComponent.js +0 -29
- package/src/components/profile/AUProfileAvatarV3Component.js +0 -80
- package/src/config/webpack.dev.config.js +0 -47
- package/src/index.js +0 -6
- package/src/lib/au-auth.js +0 -227
- package/src/lib/au-news.js +0 -371
- package/src/lib/menu.js +0 -10
- package/src/lib/urlHandler.js +0 -63
- package/src/lib/validation.js +0 -181
- package/src/styles/alert.scss +0 -39
- package/src/styles/calendar.scss +0 -112
- package/src/styles/filtercheckbox.scss +0 -5
- package/src/styles/modal.scss +0 -35
- package/src/styles/pagination.scss +0 -11
- package/src/styles/spinner.scss +0 -30
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { newsLabels as labels } from '../../lib/i18n';
|
|
5
|
-
|
|
6
|
-
class NewsSocialComponent extends React.Component {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
|
|
10
|
-
this.state = {
|
|
11
|
-
mailOpen: false,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
render() {
|
|
16
|
-
const { item, lang } = this.props;
|
|
17
|
-
const { mailOpen } = this.state;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className="au_news_socialbar" id={`au_news_socialbar-${item.id}`}>
|
|
21
|
-
<ul className="resetlist au_social_sharing horizontal icons services-4">
|
|
22
|
-
<li className="facebook">
|
|
23
|
-
<a
|
|
24
|
-
href={item.permalink}
|
|
25
|
-
onClick={(e) => {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
window.open(`https://www.facebook.com/sharer/sharer.php?u=${item.permalink}`, '', 'width=600,height=450');
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
{labels[lang].share.facebook}
|
|
31
|
-
</a>
|
|
32
|
-
</li>
|
|
33
|
-
<li className="twitter">
|
|
34
|
-
<a
|
|
35
|
-
href={item.permalink}
|
|
36
|
-
onClick={(e) => {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
const url = encodeURI(item.permalink);
|
|
39
|
-
const title = encodeURI(item.header);
|
|
40
|
-
window.open(`https://twitter.com/intent/tweet?text=${title}&url=${url}`, '', 'width=550,height=450');
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
{labels[lang].share.twitter}
|
|
44
|
-
</a>
|
|
45
|
-
</li>
|
|
46
|
-
<li className="linkedin">
|
|
47
|
-
<a
|
|
48
|
-
href={item.permalink}
|
|
49
|
-
onClick={(e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
const url = encodeURI(item.permalink);
|
|
52
|
-
window.open(`https://www.linkedin.com/shareArticle?mini=true&url=${url}`, '', 'width=850,height=550');
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
{labels[lang].share.linkedin}
|
|
56
|
-
</a>
|
|
57
|
-
</li>
|
|
58
|
-
<li className="email">
|
|
59
|
-
<a
|
|
60
|
-
href={item.permalink}
|
|
61
|
-
data-title={item.header}
|
|
62
|
-
data-url={item.permalink}
|
|
63
|
-
className={mailOpen ? 'active' : null}
|
|
64
|
-
onClick={(e) => {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
this.setState((prevState) => ({
|
|
67
|
-
mailOpen: !prevState.mailOpen,
|
|
68
|
-
}));
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{labels[lang].share.mail}
|
|
72
|
-
</a>
|
|
73
|
-
<ul className="resetlist" style={{ display: mailOpen ? 'block' : 'none' }}>
|
|
74
|
-
<li className="outlook">
|
|
75
|
-
<a title={labels[lang].share.mailLabelLong} href={`mailto:?subject=${item.header}&body=${item.permalink}`}>{labels[lang].share.mailLabelShort}</a>
|
|
76
|
-
</li>
|
|
77
|
-
<li className="gmail">
|
|
78
|
-
<a title={labels[lang].share.gmailLabelLong} target="_blank" rel="noopener noreferrer" href={`http://www.addtoany.com/add_to/google_gmail?linkurl=${item.permalink}`}>{labels[lang].share.gmailLabelShort}</a>
|
|
79
|
-
</li>
|
|
80
|
-
<li className="yahoo">
|
|
81
|
-
<a title={labels[lang].share.yahooLabelLong} target="_blank" rel="noopener noreferrer" href={`http://www.addtoany.com/add_to/yahoo_mail?linkurl=${item.permalink}`}>{labels[lang].share.yahooLabelShort}</a>
|
|
82
|
-
</li>
|
|
83
|
-
<li className="outlookcom">
|
|
84
|
-
<a title={labels[lang].share.outlookLabelLong} target="_blank" rel="noopener noreferrer" href={`http://www.addtoany.com/add_to/outlook_com?linkurl=${item.permalink}`}>{labels[lang].share.outlookLabelShort}</a>
|
|
85
|
-
</li>
|
|
86
|
-
</ul>
|
|
87
|
-
</li>
|
|
88
|
-
</ul>
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
NewsSocialComponent.propTypes = {
|
|
95
|
-
item: PropTypes.shape({
|
|
96
|
-
id: PropTypes.number.isRequired,
|
|
97
|
-
header: PropTypes.string.isRequired,
|
|
98
|
-
permalink: PropTypes.string.isRequired,
|
|
99
|
-
}).isRequired,
|
|
100
|
-
lang: PropTypes.string.isRequired,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
NewsSocialComponent.displayName = 'NewsSocialComponent';
|
|
104
|
-
export default NewsSocialComponent;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const NewsSubHeaderComponent = (props) => {
|
|
5
|
-
const { subheader, trim } = props;
|
|
6
|
-
if (subheader.length > trim) {
|
|
7
|
-
return <p dangerouslySetInnerHTML={{ __html: `${subheader.substring(0, props.trim).trim()}…` }} />;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return <p dangerouslySetInnerHTML={{ __html: subheader }} />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
NewsSubHeaderComponent.propTypes = {
|
|
14
|
-
subheader: PropTypes.string.isRequired,
|
|
15
|
-
trim: PropTypes.number.isRequired,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
NewsSubHeaderComponent.displayName = 'NewsSubHeaderComponent';
|
|
19
|
-
export default NewsSubHeaderComponent;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
/* eslint-disable max-len */
|
|
3
|
-
import React, { useEffect } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import AUPasswordRequirementsComponent from './AUPasswordRequirementsComponent';
|
|
6
|
-
import AUReceiptComponent from '../form/AUReceiptComponent';
|
|
7
|
-
import CurrentPasswordComponent from './AUCurrentPasswordComponent';
|
|
8
|
-
import AUNewPasswordComponent from './AUNewPasswordComponent';
|
|
9
|
-
import { validatePassword } from '../../lib/validation';
|
|
10
|
-
import { useAUPassword, useAUPasswordValidation } from './AUPasswordHooks';
|
|
11
|
-
import { passwordLabels } from '../../lib/i18n';
|
|
12
|
-
|
|
13
|
-
const AUChangePasswordComponent = ({
|
|
14
|
-
user: {
|
|
15
|
-
preferredLanguage,
|
|
16
|
-
},
|
|
17
|
-
password: {
|
|
18
|
-
saving,
|
|
19
|
-
saved,
|
|
20
|
-
},
|
|
21
|
-
dismissMessages,
|
|
22
|
-
messages,
|
|
23
|
-
onSave,
|
|
24
|
-
onSaveAction,
|
|
25
|
-
gotoLink,
|
|
26
|
-
}) => {
|
|
27
|
-
const [
|
|
28
|
-
{ currentPassword, setCurrentPassword },
|
|
29
|
-
{ newPassword, setNewPassword },
|
|
30
|
-
{ confirmPassword, setConfirmPassword },
|
|
31
|
-
] = useAUPassword();
|
|
32
|
-
|
|
33
|
-
const [
|
|
34
|
-
{ currentPasswordValidationMessages, setCurrentPasswordValidationMessages },
|
|
35
|
-
{
|
|
36
|
-
newPasswordValidated,
|
|
37
|
-
setNewPasswordValidated,
|
|
38
|
-
newPasswordValidationMessages,
|
|
39
|
-
setNewPasswordValidationMessages,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
confirmPasswordValidated,
|
|
43
|
-
setConfirmPasswordValidated,
|
|
44
|
-
confirmPasswordValidationMessages,
|
|
45
|
-
setConfirmPasswordValidationMessages,
|
|
46
|
-
},
|
|
47
|
-
] = useAUPasswordValidation();
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
dismissMessages();
|
|
51
|
-
}, []);
|
|
52
|
-
|
|
53
|
-
const handleSubmit = () => {
|
|
54
|
-
if (currentPassword === '') {
|
|
55
|
-
setCurrentPasswordValidationMessages([passwordLabels[preferredLanguage].currentPassword]);
|
|
56
|
-
} else {
|
|
57
|
-
const v = validatePassword(preferredLanguage, newPassword, confirmPassword, false, true);
|
|
58
|
-
setNewPasswordValidated(v.newPasswordValid);
|
|
59
|
-
setNewPasswordValidationMessages(v.newPasswordMessages);
|
|
60
|
-
setConfirmPasswordValidated(v.confirmPasswordValid);
|
|
61
|
-
setConfirmPasswordValidationMessages(v.confirmPasswordMessages);
|
|
62
|
-
if (v.newPasswordValid && v.confirmPasswordValid) {
|
|
63
|
-
onSave({
|
|
64
|
-
oldPassword: currentPassword,
|
|
65
|
-
password: newPassword,
|
|
66
|
-
}, onSaveAction);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
if (saved) {
|
|
72
|
-
return (
|
|
73
|
-
<div className="page__content__block">
|
|
74
|
-
<AUReceiptComponent
|
|
75
|
-
receiptText={passwordLabels[preferredLanguage].receipt}
|
|
76
|
-
buttons={[{
|
|
77
|
-
gotoLink,
|
|
78
|
-
gotoText: passwordLabels[preferredLanguage].goto,
|
|
79
|
-
}]}
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<div className="page__content__block">
|
|
87
|
-
<h1>{passwordLabels[preferredLanguage].changePassword}</h1>
|
|
88
|
-
<p>{passwordLabels[preferredLanguage].changePasswordInfo}</p>
|
|
89
|
-
<form
|
|
90
|
-
className="form"
|
|
91
|
-
noValidate="novalidate"
|
|
92
|
-
onSubmit={(e) => {
|
|
93
|
-
e.preventDefault();
|
|
94
|
-
handleSubmit();
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
<CurrentPasswordComponent
|
|
98
|
-
lang={preferredLanguage}
|
|
99
|
-
saving={saving}
|
|
100
|
-
errorMessages={messages.filter((x) => x.type === 'LdapFailedAuthenticationException').map((x) => x.message)}
|
|
101
|
-
setErrorMessages={dismissMessages}
|
|
102
|
-
currentPassword={currentPassword}
|
|
103
|
-
setCurrentPassword={setCurrentPassword}
|
|
104
|
-
currentPasswordValidationMessages={currentPasswordValidationMessages}
|
|
105
|
-
setCurrentPasswordValidationMessages={setCurrentPasswordValidationMessages}
|
|
106
|
-
/>
|
|
107
|
-
<hr />
|
|
108
|
-
<div className="row row--wrap-reverse row--equal-height-items">
|
|
109
|
-
<AUNewPasswordComponent
|
|
110
|
-
lang={preferredLanguage}
|
|
111
|
-
saving={saving}
|
|
112
|
-
errorMessages={messages.filter((x) => x.type === 'LdapPasswordUsedBeforeException').map((x) => x.message)}
|
|
113
|
-
setErrorMessages={dismissMessages}
|
|
114
|
-
newPassword={newPassword}
|
|
115
|
-
newPasswordValidated={newPasswordValidated}
|
|
116
|
-
newPasswordValidationMessages={newPasswordValidationMessages}
|
|
117
|
-
setNewPassword={setNewPassword}
|
|
118
|
-
setNewPasswordValidated={setNewPasswordValidated}
|
|
119
|
-
setNewPasswordValidationMessages={setNewPasswordValidationMessages}
|
|
120
|
-
confirmPassword={confirmPassword}
|
|
121
|
-
confirmPasswordValidated={confirmPasswordValidated}
|
|
122
|
-
confirmPasswordValidationMessages={confirmPasswordValidationMessages}
|
|
123
|
-
setConfirmPassword={setConfirmPassword}
|
|
124
|
-
setConfirmPasswordValidated={setConfirmPasswordValidated}
|
|
125
|
-
setConfirmPasswordValidationMessages={setConfirmPasswordValidationMessages}
|
|
126
|
-
/>
|
|
127
|
-
<AUPasswordRequirementsComponent lang={preferredLanguage} />
|
|
128
|
-
</div>
|
|
129
|
-
</form>
|
|
130
|
-
</div>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
AUChangePasswordComponent.displayName = 'AUChangePasswordComponent';
|
|
135
|
-
|
|
136
|
-
AUChangePasswordComponent.defaultProps = {
|
|
137
|
-
onSaveAction: (data, callback) => {
|
|
138
|
-
const putData = async () => {
|
|
139
|
-
let url = `${window.profileApiUri}/ChangePassword`;
|
|
140
|
-
if (typeof window.API_AUID !== 'undefined') {
|
|
141
|
-
url = `${url}?auid=${window.API_AUID}`;
|
|
142
|
-
}
|
|
143
|
-
const response = await fetch(url, {
|
|
144
|
-
method: 'PUT',
|
|
145
|
-
credentials: 'include',
|
|
146
|
-
headers: {
|
|
147
|
-
'Content-Type': 'application/json',
|
|
148
|
-
},
|
|
149
|
-
body: JSON.stringify(data),
|
|
150
|
-
});
|
|
151
|
-
const json = await response.json();
|
|
152
|
-
callback(response.ok, response.status, json);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
putData();
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
AUChangePasswordComponent.propTypes = {
|
|
160
|
-
password: PropTypes.shape({
|
|
161
|
-
saving: PropTypes.bool.isRequired,
|
|
162
|
-
saved: PropTypes.bool.isRequired,
|
|
163
|
-
}).isRequired,
|
|
164
|
-
user: PropTypes.shape({
|
|
165
|
-
preferredLanguage: PropTypes.string.isRequired,
|
|
166
|
-
}).isRequired,
|
|
167
|
-
onSave: PropTypes.func.isRequired,
|
|
168
|
-
onSaveAction: PropTypes.func,
|
|
169
|
-
dismissMessages: PropTypes.func.isRequired,
|
|
170
|
-
messages: PropTypes.arrayOf(PropTypes.shape({
|
|
171
|
-
type: PropTypes.string.isRequired,
|
|
172
|
-
message: PropTypes.string.isRequired,
|
|
173
|
-
})).isRequired,
|
|
174
|
-
gotoLink: PropTypes.string.isRequired,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export default AUChangePasswordComponent;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/label-has-associated-control */
|
|
2
|
-
/* eslint-disable jsx-a11y/label-has-for */
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { renderValidation } from '../../lib/validation';
|
|
6
|
-
import { passwordLabels } from '../../lib/i18n';
|
|
7
|
-
|
|
8
|
-
const AUCurrentPasswordComponent = ({
|
|
9
|
-
lang,
|
|
10
|
-
saving,
|
|
11
|
-
errorMessages,
|
|
12
|
-
setErrorMessages,
|
|
13
|
-
currentPassword,
|
|
14
|
-
setCurrentPassword,
|
|
15
|
-
currentPasswordValidationMessages,
|
|
16
|
-
setCurrentPasswordValidationMessages,
|
|
17
|
-
}) => {
|
|
18
|
-
const [errorMessagesSet, setErrorMessagesSet] = useState(false);
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (errorMessages.length > 0 && !errorMessagesSet) {
|
|
22
|
-
setCurrentPasswordValidationMessages([]);
|
|
23
|
-
setErrorMessagesSet(true);
|
|
24
|
-
} else if (errorMessages.length === 0 && errorMessagesSet) {
|
|
25
|
-
setErrorMessagesSet(false);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
let currentPasswordValidationClassName = '';
|
|
30
|
-
if (errorMessages.length > 0 || currentPasswordValidationMessages.length > 0) {
|
|
31
|
-
currentPasswordValidationClassName = ' form-info--error';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div className={`form__field${currentPasswordValidationClassName}`}>
|
|
36
|
-
<label htmlFor="current-password">
|
|
37
|
-
{passwordLabels[lang].currentPassword}
|
|
38
|
-
{renderValidation(errorMessages)}
|
|
39
|
-
</label>
|
|
40
|
-
<input
|
|
41
|
-
type="password"
|
|
42
|
-
id="current-password"
|
|
43
|
-
value={currentPassword}
|
|
44
|
-
onChange={(e) => {
|
|
45
|
-
setCurrentPassword(e.target.value);
|
|
46
|
-
setCurrentPasswordValidationMessages([]);
|
|
47
|
-
setErrorMessages();
|
|
48
|
-
}}
|
|
49
|
-
disabled={saving}
|
|
50
|
-
/>
|
|
51
|
-
{renderValidation(currentPasswordValidationMessages)}
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
AUCurrentPasswordComponent.defaultProps = {
|
|
57
|
-
errorMessages: [],
|
|
58
|
-
setErrorMessages: () => {},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
AUCurrentPasswordComponent.displayName = 'AUCurrentPasswordComponent';
|
|
62
|
-
AUCurrentPasswordComponent.propTypes = {
|
|
63
|
-
lang: PropTypes.string.isRequired,
|
|
64
|
-
saving: PropTypes.bool.isRequired,
|
|
65
|
-
errorMessages: PropTypes.arrayOf(PropTypes.string),
|
|
66
|
-
setErrorMessages: PropTypes.func,
|
|
67
|
-
currentPassword: PropTypes.string.isRequired,
|
|
68
|
-
setCurrentPassword: PropTypes.func.isRequired,
|
|
69
|
-
currentPasswordValidationMessages: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
70
|
-
setCurrentPasswordValidationMessages: PropTypes.func.isRequired,
|
|
71
|
-
};
|
|
72
|
-
export default AUCurrentPasswordComponent;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/label-has-associated-control */
|
|
2
|
-
/* eslint-disable jsx-a11y/label-has-for */
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { renderValidation, validatePassword } from '../../lib/validation';
|
|
6
|
-
import { passwordLabels } from '../../lib/i18n';
|
|
7
|
-
|
|
8
|
-
const AUNewPasswordComponent = ({
|
|
9
|
-
lang,
|
|
10
|
-
saving,
|
|
11
|
-
errorMessages,
|
|
12
|
-
setErrorMessages,
|
|
13
|
-
newPassword,
|
|
14
|
-
newPasswordValidated,
|
|
15
|
-
newPasswordValidationMessages,
|
|
16
|
-
setNewPassword,
|
|
17
|
-
setNewPasswordValidated,
|
|
18
|
-
setNewPasswordValidationMessages,
|
|
19
|
-
confirmPassword,
|
|
20
|
-
confirmPasswordValidated,
|
|
21
|
-
confirmPasswordValidationMessages,
|
|
22
|
-
setConfirmPassword,
|
|
23
|
-
setConfirmPasswordValidated,
|
|
24
|
-
setConfirmPasswordValidationMessages,
|
|
25
|
-
}) => {
|
|
26
|
-
const [errorMessagesSet, setErrorMessagesSet] = useState(false);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (errorMessages.length > 0 && !errorMessagesSet) {
|
|
30
|
-
setNewPasswordValidationMessages([]);
|
|
31
|
-
setConfirmPasswordValidationMessages([]);
|
|
32
|
-
setErrorMessagesSet(true);
|
|
33
|
-
} else if (errorMessages.length === 0 && errorMessagesSet) {
|
|
34
|
-
setErrorMessagesSet(false);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
let newPasswordValidationClassName = '';
|
|
39
|
-
if (errorMessages.length > 0
|
|
40
|
-
|| (newPasswordValidationMessages.length > 0 && !newPasswordValidated)) {
|
|
41
|
-
newPasswordValidationClassName = ' form-info--error';
|
|
42
|
-
} else if (newPasswordValidated) {
|
|
43
|
-
newPasswordValidationClassName = ' form-info--confirmed';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let confirmPasswordValidationClassName = '';
|
|
47
|
-
if (errorMessages.length > 0
|
|
48
|
-
|| (confirmPasswordValidationMessages.length > 0 && !confirmPasswordValidated)) {
|
|
49
|
-
confirmPasswordValidationClassName = ' form-info--error';
|
|
50
|
-
} else if (confirmPasswordValidated) {
|
|
51
|
-
confirmPasswordValidationClassName = ' form-info--confirmed';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<div className="row__item row__item--basis-default-line-width">
|
|
56
|
-
<div className={`form__field${newPasswordValidationClassName}`}>
|
|
57
|
-
<label htmlFor="new-password">
|
|
58
|
-
{passwordLabels[lang].newPassword}
|
|
59
|
-
<span className="form-info__hint">{passwordLabels[lang].newPasswordInfo}</span>
|
|
60
|
-
{renderValidation(errorMessages)}
|
|
61
|
-
</label>
|
|
62
|
-
{renderValidation(newPasswordValidationMessages)}
|
|
63
|
-
<input
|
|
64
|
-
type="password"
|
|
65
|
-
id="new-password"
|
|
66
|
-
value={newPassword}
|
|
67
|
-
onChange={(e) => {
|
|
68
|
-
const v = validatePassword(lang, e.target.value, confirmPassword);
|
|
69
|
-
setNewPassword(e.target.value);
|
|
70
|
-
setConfirmPassword('');
|
|
71
|
-
setNewPasswordValidated(v.newPasswordValid);
|
|
72
|
-
setNewPasswordValidationMessages(v.newPasswordMessages);
|
|
73
|
-
setConfirmPasswordValidationMessages([]);
|
|
74
|
-
setErrorMessages();
|
|
75
|
-
}}
|
|
76
|
-
onBlur={(e) => {
|
|
77
|
-
const v = validatePassword(lang, e.target.value, confirmPassword, true);
|
|
78
|
-
setNewPasswordValidated(v.newPasswordValid);
|
|
79
|
-
setNewPasswordValidationMessages(v.newPasswordMessages);
|
|
80
|
-
}}
|
|
81
|
-
disabled={saving}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
<div className={`form__field${confirmPasswordValidationClassName}`}>
|
|
85
|
-
<label htmlFor="repeated-password">{passwordLabels[lang].repeatPassword}</label>
|
|
86
|
-
{renderValidation(confirmPasswordValidationMessages)}
|
|
87
|
-
<input
|
|
88
|
-
type="password"
|
|
89
|
-
id="repeated-password"
|
|
90
|
-
value={confirmPassword}
|
|
91
|
-
onChange={(e) => {
|
|
92
|
-
const v = validatePassword(lang, newPassword, e.target.value);
|
|
93
|
-
setConfirmPassword(e.target.value);
|
|
94
|
-
setConfirmPasswordValidated(v.confirmPasswordValid);
|
|
95
|
-
setConfirmPasswordValidationMessages(v.confirmPasswordMessages);
|
|
96
|
-
}}
|
|
97
|
-
onBlur={(e) => {
|
|
98
|
-
const v = validatePassword(lang, newPassword, e.target.value, true);
|
|
99
|
-
setConfirmPasswordValidated(v.confirmPasswordValid);
|
|
100
|
-
setConfirmPasswordValidationMessages(v.confirmPasswordMessages);
|
|
101
|
-
}}
|
|
102
|
-
disabled={saving}
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
<div className="submit">
|
|
106
|
-
<div className={`${saving ? 'submit-input-wrapper--processing' : ''}`}>
|
|
107
|
-
<input
|
|
108
|
-
className="button"
|
|
109
|
-
type="submit"
|
|
110
|
-
value={passwordLabels[lang].changePassword}
|
|
111
|
-
disabled={saving}
|
|
112
|
-
/>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
AUNewPasswordComponent.defaultProps = {
|
|
120
|
-
errorMessages: [],
|
|
121
|
-
setErrorMessages: () => {},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
AUNewPasswordComponent.displayName = 'AUNewPasswordComponent';
|
|
125
|
-
AUNewPasswordComponent.propTypes = {
|
|
126
|
-
lang: PropTypes.string.isRequired,
|
|
127
|
-
saving: PropTypes.bool.isRequired,
|
|
128
|
-
errorMessages: PropTypes.arrayOf(PropTypes.string),
|
|
129
|
-
setErrorMessages: PropTypes.func,
|
|
130
|
-
newPassword: PropTypes.string.isRequired,
|
|
131
|
-
newPasswordValidated: PropTypes.bool.isRequired,
|
|
132
|
-
newPasswordValidationMessages: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
133
|
-
setNewPassword: PropTypes.func.isRequired,
|
|
134
|
-
setNewPasswordValidated: PropTypes.func.isRequired,
|
|
135
|
-
setNewPasswordValidationMessages: PropTypes.func.isRequired,
|
|
136
|
-
confirmPassword: PropTypes.string.isRequired,
|
|
137
|
-
confirmPasswordValidated: PropTypes.bool.isRequired,
|
|
138
|
-
confirmPasswordValidationMessages: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
139
|
-
setConfirmPassword: PropTypes.func.isRequired,
|
|
140
|
-
setConfirmPasswordValidated: PropTypes.func.isRequired,
|
|
141
|
-
setConfirmPasswordValidationMessages: PropTypes.func.isRequired,
|
|
142
|
-
};
|
|
143
|
-
export default AUNewPasswordComponent;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
export const PATCH_PASSWORD = 'PATCH_PASSWORD';
|
|
3
|
-
export const SAVING_PASSWORD = 'SAVING_PASSWORD';
|
|
4
|
-
export const DISMISS_MESSAGES = 'DISMISS_MESSAGES';
|
|
5
|
-
export const SET_SAVED = 'SET_SAVED';
|
|
6
|
-
export const SENDING_MAIL = 'SENDING_MAIL';
|
|
7
|
-
export const SEND_MAIL = 'SEND_MAIL';
|
|
8
|
-
export const GETTING_TOKEN_STATUS = 'GETTING_TOKEN_STATUS';
|
|
9
|
-
export const GET_TOKEN_STATUS = 'GET_TOKEN_STATUS';
|
|
10
|
-
|
|
11
|
-
export const getActionCreators = () => {
|
|
12
|
-
const actionCreators = {
|
|
13
|
-
clear: () => (dispatch) => {
|
|
14
|
-
dispatch({
|
|
15
|
-
type: SET_SAVED,
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
dismissMessages: () => (dispatch) => {
|
|
19
|
-
dispatch({
|
|
20
|
-
type: DISMISS_MESSAGES,
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
patchPassword: (data, callback, lang = 'da') => async (dispatch) => {
|
|
24
|
-
dispatch({
|
|
25
|
-
type: SAVING_PASSWORD,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
callback(data, (ok, status, json) => {
|
|
29
|
-
const result = {};
|
|
30
|
-
if (ok) {
|
|
31
|
-
result.password = true;
|
|
32
|
-
} else {
|
|
33
|
-
result.error = json;
|
|
34
|
-
result.error.lang = lang;
|
|
35
|
-
}
|
|
36
|
-
result.status = status;
|
|
37
|
-
dispatch({
|
|
38
|
-
type: PATCH_PASSWORD,
|
|
39
|
-
result,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
patchPasswordAnonymous: (endpoint, type, userToken, data, callback, lang = 'da') => async (dispatch) => {
|
|
44
|
-
dispatch({
|
|
45
|
-
type: SAVING_PASSWORD,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
callback(endpoint, type, userToken, data, (ok, status, json, actionType) => {
|
|
49
|
-
const result = {};
|
|
50
|
-
if (ok) {
|
|
51
|
-
result.password = json;
|
|
52
|
-
} else {
|
|
53
|
-
result.error = json;
|
|
54
|
-
result.error.lang = lang;
|
|
55
|
-
}
|
|
56
|
-
result.status = status;
|
|
57
|
-
dispatch({
|
|
58
|
-
type: actionType,
|
|
59
|
-
result,
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
sendMail: (data, callback, lang = 'da') => async (dispatch) => {
|
|
64
|
-
dispatch({
|
|
65
|
-
type: SENDING_MAIL,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
callback(data, (ok, status, json) => {
|
|
69
|
-
const result = {};
|
|
70
|
-
if (ok) {
|
|
71
|
-
result.password = true;
|
|
72
|
-
} else {
|
|
73
|
-
result.error = json;
|
|
74
|
-
result.error.lang = lang;
|
|
75
|
-
}
|
|
76
|
-
result.status = status;
|
|
77
|
-
dispatch({
|
|
78
|
-
type: SEND_MAIL,
|
|
79
|
-
result,
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
checkUserTokenIsValid: (userToken, callback) => async (dispatch) => {
|
|
84
|
-
dispatch({
|
|
85
|
-
type: GETTING_TOKEN_STATUS,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
callback(userToken, (ok, status) => {
|
|
89
|
-
const result = {};
|
|
90
|
-
result.token = ok;
|
|
91
|
-
result.status = status;
|
|
92
|
-
dispatch({
|
|
93
|
-
type: GET_TOKEN_STATUS,
|
|
94
|
-
result,
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return actionCreators;
|
|
101
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
|
|
4
|
-
const useAUPassword = () => {
|
|
5
|
-
const [currentPassword, setCurrentPassword] = useState('');
|
|
6
|
-
const [newPassword, setNewPassword] = useState('');
|
|
7
|
-
const [confirmPassword, setConfirmPassword] = useState('');
|
|
8
|
-
|
|
9
|
-
return [{
|
|
10
|
-
currentPassword,
|
|
11
|
-
setCurrentPassword,
|
|
12
|
-
}, {
|
|
13
|
-
newPassword,
|
|
14
|
-
setNewPassword,
|
|
15
|
-
}, {
|
|
16
|
-
confirmPassword,
|
|
17
|
-
setConfirmPassword,
|
|
18
|
-
}];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const useAUPasswordValidation = () => {
|
|
22
|
-
const [currentPasswordValidationMessages, setCurrentPasswordValidationMessages] = useState([]);
|
|
23
|
-
const [newPasswordValidated, setNewPasswordValidated] = useState(false);
|
|
24
|
-
const [newPasswordValidationMessages, setNewPasswordValidationMessages] = useState([]);
|
|
25
|
-
const [confirmPasswordValidated, setConfirmPasswordValidated] = useState(false);
|
|
26
|
-
const [confirmPasswordValidationMessages, setConfirmPasswordValidationMessages] = useState([]);
|
|
27
|
-
|
|
28
|
-
return [{
|
|
29
|
-
currentPasswordValidationMessages,
|
|
30
|
-
setCurrentPasswordValidationMessages,
|
|
31
|
-
}, {
|
|
32
|
-
newPasswordValidated,
|
|
33
|
-
setNewPasswordValidated,
|
|
34
|
-
newPasswordValidationMessages,
|
|
35
|
-
setNewPasswordValidationMessages,
|
|
36
|
-
}, {
|
|
37
|
-
confirmPasswordValidated,
|
|
38
|
-
setConfirmPasswordValidated,
|
|
39
|
-
confirmPasswordValidationMessages,
|
|
40
|
-
setConfirmPasswordValidationMessages,
|
|
41
|
-
}];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
useAUPassword,
|
|
46
|
-
useAUPasswordValidation,
|
|
47
|
-
};
|