abmp-npm 2.0.85 → 2.0.86
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// cannot drift on what "expired" means. Deliberately free of Wix imports.
|
|
3
3
|
|
|
4
4
|
const ASSOCIATION_EXPIRATION_FIELD = 'associationExpiration';
|
|
5
|
+
const PAC_STAFF_MEMBERTYPE = 'PAC STAFF';
|
|
5
6
|
const ASSOCIATION_TIME_ZONE = 'America/Denver';
|
|
6
7
|
|
|
7
8
|
const EXPIRATION_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
@@ -128,7 +129,20 @@ const isAssociationExpirationCurrent = (member, now) => {
|
|
|
128
129
|
return expiration.getTime() >= getTodayInAssociationTimeZone(now).getTime();
|
|
129
130
|
};
|
|
130
131
|
|
|
132
|
+
// PAC staff accounts carry a rolling "expiration" equal to the date of the feed that last mentioned
|
|
133
|
+
// them, so the association gate would lock a staff member out on any day the feed did not resend
|
|
134
|
+
// them (ticket 13031107600). Staff are already excluded from the directory and have no public
|
|
135
|
+
// profile; login is the one place the gate reaches them, and it should not.
|
|
136
|
+
const isPacStaff = member =>
|
|
137
|
+
Array.isArray(member?.memberships) &&
|
|
138
|
+
member.memberships.some(membership => membership?.membertype === PAC_STAFF_MEMBERTYPE);
|
|
139
|
+
|
|
140
|
+
const isLoginAllowedByExpiration = (member, now) =>
|
|
141
|
+
isPacStaff(member) || isAssociationExpirationCurrent(member, now);
|
|
142
|
+
|
|
131
143
|
module.exports = {
|
|
144
|
+
isPacStaff,
|
|
145
|
+
isLoginAllowedByExpiration,
|
|
132
146
|
parseExpirationToUtcDate,
|
|
133
147
|
classifyAssociationExpiration,
|
|
134
148
|
resolveAssociationExpiration,
|
|
@@ -3,7 +3,7 @@ const { createHmac } = require('crypto');
|
|
|
3
3
|
const axios = require('axios');
|
|
4
4
|
const { decode } = require('jwt-js-decode');
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { isLoginAllowedByExpiration } = require('../association-expiry');
|
|
7
7
|
const { CONFIG_KEYS, SSO_TOKEN_AUTH_API_URL, LOGIN_REFUSAL_REASONS } = require('../consts');
|
|
8
8
|
const { MEMBER_ACTIONS } = require('../daily-pull/consts');
|
|
9
9
|
const { getCurrentMember } = require('../members-area-methods');
|
|
@@ -80,7 +80,7 @@ async function validateMemberToken(memberIdInput) {
|
|
|
80
80
|
return invalidTokenResponse;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (!
|
|
83
|
+
if (!isLoginAllowedByExpiration(memberData)) {
|
|
84
84
|
console.log(
|
|
85
85
|
`[validateMemberToken] association membership expired for memberId ${memberData.memberId}`
|
|
86
86
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { COLLECTIONS } = require('../public/consts');
|
|
2
2
|
const { isWixHostedImage, emailsMatch, normalizeEmail } = require('../public/Utils/sharedUtils');
|
|
3
3
|
|
|
4
|
-
const {
|
|
4
|
+
const { isLoginAllowedByExpiration } = require('./association-expiry');
|
|
5
5
|
const { MEMBERSHIPS_TYPES, LOGIN_REFUSAL_REASONS } = require('./consts');
|
|
6
6
|
const { createSiteContact } = require('./contacts-methods');
|
|
7
7
|
const { MEMBER_ACTIONS } = require('./daily-pull/consts');
|
|
@@ -701,7 +701,7 @@ async function prepareMemberForSSOLogin(data) {
|
|
|
701
701
|
if (!memberData) {
|
|
702
702
|
throw new Error(`Member data not found for memberId ${memberId}`);
|
|
703
703
|
}
|
|
704
|
-
if (!
|
|
704
|
+
if (!isLoginAllowedByExpiration(memberData)) {
|
|
705
705
|
console.log(
|
|
706
706
|
`[prepareMemberForSSOLogin] refusing login, association membership expired for memberId ${memberId}`
|
|
707
707
|
);
|