Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { payload } = yield take(actionTypes.LOGIN_REQUEST);
const host = yield call(transformValidHost, payload.host);
const protocol = host.protocol.slice(0, -1);
yield put(authActions.addAuthDebugMessage([
{ string: 'Login request...' },
{ string: `host: ${host.hostname}` },
{ string: `protocol: ${protocol}` },
{ string: `port: ${host.port}` },
{ string: `path_prefix: ${host.pathname}` },
{ string: `username: ${payload.username}` },
{ string: 'password: ***' },
]));
yield put(uiActions.setUiState('loginRequestInProcess', true));
yield put(uiActions.setUiState('loginError', null));
yield call(
jira.basicAuth,
{
...payload,
host: host.hostname,
protocol,
port: host.port,
path_prefix: host.pathname,
},
);
// Test request for check auth
const {
debug,
result,
} = yield call(Api.jiraProfile, true);
yield put(authActions.addAuthDebugMessage([
render() {
let { lang, image, name, statsKey, scale } = this.props;
const field = getField(statsKey);
const label = name ? name[lang] : translate(statsKey, lang);
const cn = classNames('avatar center', { scale });
return (
<div>
<img size="lg">
<div>{label}</div>
</div>
);
}
{fields.map(f => {
if (f === 'rarity') {
return (
<div>
{translate('rarity', lang)}
</div>
);
}
return <div>;
})}
</div>
{fields.map((field) => {
if (field === "rarity") {
return (
<div>
{translate("rarity", lang)}
</div>
);
}
return (
<div>
</div>
);
})}
{rows.map((row) => {
let { HP = 0, STR = 0, might = 0 } = details[row] || {};
return (
<div>
<div>{translate(row, lang)}</div>
<div>{HP}</div>
<div>{STR}</div>
<div>{might}</div>
</div>
);
})}
rows.map(row => {
const { HP, STR, might } = details[row];
return (
{translate(row, lang)}
{HP}
{STR}
{might}
);
})}
baseUrl: href.replace(/\/$/, ''),
});
yield eff.put(authActions.authRequest({
protocol,
hostname,
port,
pathname,
cookies,
}));
} catch (err) {
if (err && err.message) {
yield eff.put(uiActions.setUiState({
authError: err.message,
}));
} else {
yield eff.put(uiActions.setUiState(
'authError',
'Can not authenticate user. Please try again',
));
}
yield eff.call(throwError, err);
yield eff.put(uiActions.setUiState({
authRequestInProcess: false,
}));
}
}
}
},
} : {}
),
body: {
...data,
jql,
},
},
);
yield eff.fork(notify, {
title: `Save filter ${filter.name}`,
});
yield eff.put(actions.succeeded({
resources: [filter],
}));
yield eff.put(uiActions.setUiState({
saveFilterDialogOpen: false,
issuesSourceId: filter.id,
filterStatusesIsFetched: false,
}));
yield eff.put(resourcesActions.clearResourceList({
resourceType: 'issues',
list: 'recentIssues',
}));
yield eff.put(issuesActions.refetchIssuesRequest());
} catch (err) {
throwError(err);
yield eff.put(actions.failed());
const errObj = JSON.parse(err);
if (errObj.body.errorMessages.length > 0) {
yield eff.fork(notify, {
title: 'Failed to save filter',
export function* initializeApp(): Generator<*, *, *> {
yield eff.put(uiActions.setUiState({
initializeInProcess: true,
}));
try {
const accounts = yield eff.call(
getElectronStorage,
'accounts',
[],
);
yield eff.put(uiActions.setUiState({
accounts,
}));
const authCredentials = yield eff.call(
getElectronStorage,
'last_used_account',
);
const authDataExist = (
);
yield put(uiActions.setUiState('loginRequestInProcess', false));
trackMixpanel('Jira login');
incrementMixpanel('Jira login', 1);
} catch (err) {
if (err.debug) {
err.debug.options.auth.password = '***';
err.debug.request.headers.authorization = '***';
yield put(authActions.addAuthDebugMessage([
{
json: err.debug,
},
]));
}
yield put(uiActions.setUiState('loginRequestInProcess', false));
yield put(uiActions.setUiState(
'loginError',
'Can not authenticate user. Please try again',
));
yield call(throwError, err.result ? err.result : err);
}
}
}