mirror of
https://github.com/plankanban/planka.git
synced 2025-08-09 15:35:29 +02:00
ref: Fix linting
This commit is contained in:
parent
4db8f3e23e
commit
e7e5a77c97
2 changed files with 26 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { apply, call, put, select, take } from 'redux-saga/effects';
|
import { call, put, select, take } from 'redux-saga/effects';
|
||||||
|
|
||||||
import request from '../request';
|
import request from '../request';
|
||||||
import requests from '../requests';
|
import requests from '../requests';
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { apply, call, put, select } from 'redux-saga/effects';
|
import { nanoid } from 'nanoid';
|
||||||
|
import { call, put, select } from 'redux-saga/effects';
|
||||||
import { replace } from '../../../lib/redux-router';
|
import { replace } from '../../../lib/redux-router';
|
||||||
|
|
||||||
import selectors from '../../../selectors';
|
import selectors from '../../../selectors';
|
||||||
import actions from '../../../actions';
|
import actions from '../../../actions';
|
||||||
import api from '../../../api';
|
import api from '../../../api';
|
||||||
import { setAccessToken } from '../../../utils/access-token-storage';
|
import { setAccessToken } from '../../../utils/access-token-storage';
|
||||||
import Paths from '../../../constants/Paths';
|
import Paths from '../../../constants/Paths';
|
||||||
import { nanoid } from 'nanoid';
|
|
||||||
|
|
||||||
export function* initializeLogin() {
|
export function* initializeLogin() {
|
||||||
const { item: config } = yield call(api.getConfig); // TODO: handle error
|
const { item: config } = yield call(api.getConfig); // TODO: handle error
|
||||||
|
@ -32,30 +33,42 @@ export function* authenticateWithOidc() {
|
||||||
const oidcConfig = yield select(selectors.selectOidcConfig);
|
const oidcConfig = yield select(selectors.selectOidcConfig);
|
||||||
|
|
||||||
const nonce = nanoid();
|
const nonce = nanoid();
|
||||||
window.sessionStorage.setItem("oidc-nonce", nonce);
|
window.sessionStorage.setItem('oidc-nonce', nonce);
|
||||||
window.location.replace(oidcConfig.authorizationUrl + "&nonce=" + encodeURIComponent(nonce));
|
window.location.replace(`${oidcConfig.authorizationUrl}&nonce=${encodeURIComponent(nonce)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* authenticateWithOidcCallback() {
|
export function* authenticateWithOidcCallback() {
|
||||||
const params = new URLSearchParams(window.location.hash.substring(1));
|
const params = new URLSearchParams(window.location.hash.substring(1));
|
||||||
if(params.get("error") !== null) {
|
if (params.get('error') !== null) {
|
||||||
yield put(actions.authenticateWithOidc.failure(new Error(`OIDC Authorization error: ${params.get("error")}: ${params.get("error_description")}`)));
|
yield put(
|
||||||
|
actions.authenticateWithOidc.failure(
|
||||||
|
new Error(
|
||||||
|
`OIDC Authorization error: ${params.get('error')}: ${params.get('error_description')}`,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nonce = window.sessionStorage.getItem("oidc-nonce");
|
const nonce = window.sessionStorage.getItem('oidc-nonce');
|
||||||
if (nonce === null) {
|
if (nonce === null) {
|
||||||
yield put(actions.authenticateWithOidc.failure(new Error("Unable to process OIDC response: no nonce issued")));
|
yield put(
|
||||||
|
actions.authenticateWithOidc.failure(
|
||||||
|
new Error('Unable to process OIDC response: no nonce issued'),
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const code = params.get("code");
|
const code = params.get('code');
|
||||||
if(code === null) {
|
if (code === null) {
|
||||||
yield put(actions.authenticateWithOidc.failure(new Error("Invalid OIDC response: no code parameter")));
|
yield put(
|
||||||
|
actions.authenticateWithOidc.failure(new Error('Invalid OIDC response: no code parameter')),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.sessionStorage.removeItem("oidc-nonce");
|
window.sessionStorage.removeItem('oidc-nonce');
|
||||||
|
|
||||||
yield put(replace(Paths.LOGIN));
|
yield put(replace(Paths.LOGIN));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue