windmill-components 1.377.7 → 1.377.8
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.
|
@@ -19,7 +19,7 @@ export let password = undefined;
|
|
|
19
19
|
export let error = undefined;
|
|
20
20
|
export let popup = false;
|
|
21
21
|
export let loginPasswordRequireEEOnPublicApps = false;
|
|
22
|
-
export let gotoFn =
|
|
22
|
+
export let gotoFn = undefined;
|
|
23
23
|
const providers = [
|
|
24
24
|
{
|
|
25
25
|
type: 'github',
|
|
@@ -74,13 +74,18 @@ async function login() {
|
|
|
74
74
|
$userStore = await getUserExt($workspaceStore);
|
|
75
75
|
}
|
|
76
76
|
// Finally, we check whether the user is a superadmin
|
|
77
|
-
refreshSuperadmin();
|
|
78
|
-
|
|
77
|
+
refreshSuperadmin(gotoFn);
|
|
78
|
+
if (gotoFn) {
|
|
79
|
+
redirectUser();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
dispatch('login');
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
async function redirectUser() {
|
|
81
86
|
const firstTimeCookie = document.cookie.match('(^|;)\\s*first_time\\s*=\\s*([^;]+)')?.pop() || '0';
|
|
82
87
|
if (Number(firstTimeCookie) > 0 && email === 'admin@windmill.dev') {
|
|
83
|
-
gotoFn('/user/first-time');
|
|
88
|
+
gotoFn?.('/user/first-time');
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
if (rd?.startsWith('http')) {
|
|
@@ -88,13 +93,13 @@ async function redirectUser() {
|
|
|
88
93
|
return;
|
|
89
94
|
}
|
|
90
95
|
if ($workspaceStore) {
|
|
91
|
-
gotoFn(rd ?? '/');
|
|
96
|
+
gotoFn?.(rd ?? '/');
|
|
92
97
|
}
|
|
93
98
|
else {
|
|
94
99
|
let workspaceTarget = parseQueryParams(rd ?? undefined)['workspace'];
|
|
95
100
|
if (rd && workspaceTarget) {
|
|
96
101
|
$workspaceStore = workspaceTarget;
|
|
97
|
-
gotoFn(rd);
|
|
102
|
+
gotoFn?.(rd);
|
|
98
103
|
return;
|
|
99
104
|
}
|
|
100
105
|
if (!$usersWorkspaceStore) {
|
|
@@ -112,24 +117,24 @@ async function redirectUser() {
|
|
|
112
117
|
workspace: $workspaceStore
|
|
113
118
|
});
|
|
114
119
|
if (!emptyString(defaultApp.default_app_path)) {
|
|
115
|
-
gotoFn(`/apps/get/${defaultApp.default_app_path}`);
|
|
120
|
+
gotoFn?.(`/apps/get/${defaultApp.default_app_path}`);
|
|
116
121
|
}
|
|
117
122
|
else {
|
|
118
|
-
gotoFn(rd ?? '/');
|
|
123
|
+
gotoFn?.(rd ?? '/');
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
else {
|
|
122
|
-
gotoFn(rd ?? '/');
|
|
127
|
+
gotoFn?.(rd ?? '/');
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
130
|
else if (rd?.startsWith('/user/workspaces')) {
|
|
126
|
-
gotoFn(rd);
|
|
131
|
+
gotoFn?.(rd);
|
|
127
132
|
}
|
|
128
133
|
else if (rd == '/#user-settings') {
|
|
129
|
-
gotoFn(`/user/workspaces#user-settings`);
|
|
134
|
+
gotoFn?.(`/user/workspaces#user-settings`);
|
|
130
135
|
}
|
|
131
136
|
else {
|
|
132
|
-
gotoFn(`/user/workspaces${rd ? `?rd=${encodeURIComponent(rd)}` : ''}`);
|
|
137
|
+
gotoFn?.(`/user/workspaces${rd ? `?rd=${encodeURIComponent(rd)}` : ''}`);
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
}
|
package/package/refreshUser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function refreshSuperadmin(): Promise<void>;
|
|
1
|
+
export declare function refreshSuperadmin(gotoFn: ((path: string, opt?: Record<string, any> | undefined) => void) | undefined): Promise<void>;
|
package/package/refreshUser.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { get } from 'svelte/store';
|
|
2
2
|
import { UserService } from './gen';
|
|
3
3
|
import { superadmin } from './stores.js';
|
|
4
|
-
|
|
5
|
-
export async function refreshSuperadmin() {
|
|
4
|
+
export async function refreshSuperadmin(gotoFn) {
|
|
6
5
|
if (get(superadmin) == undefined) {
|
|
7
6
|
try {
|
|
8
7
|
const me = await UserService.globalWhoami();
|
|
@@ -15,7 +14,7 @@ export async function refreshSuperadmin() {
|
|
|
15
14
|
}
|
|
16
15
|
catch {
|
|
17
16
|
superadmin.set(false);
|
|
18
|
-
|
|
17
|
+
gotoFn?.('/user/logout');
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
}
|