@amedia/user 0.14.3 → 0.14.4
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/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
attemptPaywallAutoLogin,
|
|
6
6
|
AUTOLOGIN_COOKIE_TTL,
|
|
7
7
|
} from './index';
|
|
8
|
+
import log from '../utils/log';
|
|
8
9
|
import * as location from '../utils/location';
|
|
9
10
|
import * as url from '../utils/url';
|
|
10
11
|
import * as cookie from '../lib/cookie';
|
|
@@ -150,7 +151,9 @@ describe('attemptAutoLoginJob', () => {
|
|
|
150
151
|
});
|
|
151
152
|
|
|
152
153
|
describe('when in aid emergency mode', () => {
|
|
154
|
+
let logWarnSpy: jasmine.Spy;
|
|
153
155
|
beforeEach(async () => {
|
|
156
|
+
logWarnSpy = spyOn(log, `warn`).and.stub();
|
|
154
157
|
store.merge('state', {
|
|
155
158
|
emergencyMode: ['aid'],
|
|
156
159
|
});
|
|
@@ -160,6 +163,15 @@ describe('attemptAutoLoginJob', () => {
|
|
|
160
163
|
it('should not try third party auto login', () => {
|
|
161
164
|
expect(thirdPartyCookie.default).not.toHaveBeenCalled();
|
|
162
165
|
});
|
|
166
|
+
|
|
167
|
+
it('should log warning about being in aid emergency mode', () => {
|
|
168
|
+
expect(logWarnSpy).toHaveBeenCalledWith(
|
|
169
|
+
'Autologin prevented. We are in aid emergency mode.',
|
|
170
|
+
{
|
|
171
|
+
emergencyModes: ['aid'],
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
});
|
|
163
175
|
});
|
|
164
176
|
});
|
|
165
177
|
});
|
package/src/autologin/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { navigateTo } from '../utils/location';
|
|
|
4
4
|
import { getCookie, removeCookie, setCookie } from '../lib/cookie';
|
|
5
5
|
import UserDataRequest from '../lib/UserDataRequest';
|
|
6
6
|
import store from '../store';
|
|
7
|
+
import log from '../utils/log';
|
|
7
8
|
|
|
8
9
|
export type Strategies = Array<{
|
|
9
10
|
name: string;
|
|
@@ -55,6 +56,9 @@ const attemptAutologin = async (strategies: Strategies) => {
|
|
|
55
56
|
|
|
56
57
|
if (isInAidEmergencyMode()) {
|
|
57
58
|
// Avoid auto-login if we are in aid emergency mode
|
|
59
|
+
log.warn('Autologin prevented. We are in aid emergency mode.', {
|
|
60
|
+
emergencyModes: store.get('state')?.emergencyMode,
|
|
61
|
+
});
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
64
|
|