in frontend/src/js/actions/auth/getAuthToken.js [5:36]
export function getAuthToken(username, password, tfaCode) {
return dispatch => {
dispatch(requestToken(username));
return getToken(username, password, tfaCode)
.then(response => {
const status = response.status;
const authHeader = response.headers.get('X-Offer-Authorization');
const authenticate = response.headers.get('WWW-Authenticate');
if (status === 204 && authHeader) {
localStorage.pfiAuthHeader = authHeader;
dispatch(receiveToken(authHeader));
clearAllErrors()(dispatch);
clearAllWarnings()(dispatch);
} else if (status === 401 && authenticate === 'Pfi2fa') {
response.text().then(text => {
dispatch(require2fa(text));
});
} else if (status === 401 && authenticate === 'Panda') {
response.text().then(text => {
dispatch(requirePanda(text));
});
} else if (status === 403) {
response.text().then(text => {
dispatch(forbidden(text));
});
} else {
dispatch(errorReceivingToken(username, 'login failure'));
}
})
.catch(error => dispatch(errorReceivingToken(error)));
};
}