chore: Pass sso_account_id to select the account during SSO Login (#4103)
This commit is contained in:
@@ -6,7 +6,7 @@ import authAPI from '../../api/auth';
|
||||
import createAxios from '../../helper/APIHelper';
|
||||
import actionCable from '../../helper/actionCable';
|
||||
import { setUser, getHeaderExpiry, clearCookiesOnLogout } from '../utils/api';
|
||||
import { DEFAULT_REDIRECT_URL } from '../../constants';
|
||||
import { getLoginRedirectURL } from '../../helper/URLHelper';
|
||||
|
||||
const state = {
|
||||
currentUser: {
|
||||
@@ -88,15 +88,16 @@ export const getters = {
|
||||
|
||||
// actions
|
||||
export const actions = {
|
||||
login({ commit }, credentials) {
|
||||
login({ commit }, { ssoAccountId, ...credentials }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
authAPI
|
||||
.login(credentials)
|
||||
.then(() => {
|
||||
.then(response => {
|
||||
commit(types.default.SET_CURRENT_USER);
|
||||
window.axios = createAxios(axios);
|
||||
actionCable.init(Vue);
|
||||
window.location = DEFAULT_REDIRECT_URL;
|
||||
|
||||
window.location = getLoginRedirectURL(ssoAccountId, response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
@@ -38,13 +38,15 @@ export const setAuthCredentials = response => {
|
||||
setUser(response.data.data, expiryDate);
|
||||
};
|
||||
|
||||
export const clearBrowserSessionCookies = () => {
|
||||
Cookies.remove('auth_data');
|
||||
Cookies.remove('user');
|
||||
};
|
||||
|
||||
export const clearCookiesOnLogout = () => {
|
||||
window.bus.$emit(CHATWOOT_RESET);
|
||||
window.bus.$emit(ANALYTICS_RESET);
|
||||
|
||||
Cookies.remove('auth_data');
|
||||
Cookies.remove('user');
|
||||
|
||||
clearBrowserSessionCookies();
|
||||
const globalConfig = window.globalConfig || {};
|
||||
const logoutRedirectLink =
|
||||
globalConfig.LOGOUT_REDIRECT_LINK || frontendURL('login');
|
||||
|
||||
Reference in New Issue
Block a user