HUB
List of managed firms
{ownedFirms.map((f: IFirm, index) => (
- - {f.instance} / {f.name}
+ - {f.instance} / {f.firm}
))}
List of firm you're working at
{user.firms.map((f: IFirm, index) => (
- - {f.instance} / {f.name}
+ -
+ {f.instance} / {f.firm}
+
))}
-
+
+
- );
-};
+ )
+}
diff --git a/gui/rpk-gui/src/providers/auth-provider.tsx b/gui/rpk-gui/src/providers/auth-provider.tsx
index 3355254..38ee3ba 100644
--- a/gui/rpk-gui/src/providers/auth-provider.tsx
+++ b/gui/rpk-gui/src/providers/auth-provider.tsx
@@ -7,9 +7,12 @@ const LOCAL_STORAGE_USER_KEY = "rpk-gui-current-user";
const GOOGLE_SCOPES = { "scopes": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email" };
const DISCORD_SCOPES = { "scopes": "identify email" }
+const DEFAULT_LOGIN_REDIRECT = "/hub"
+
export const authProvider: AuthProvider = {
login: async ({ providerName, email, password }) => {
const to_param = findGetParameter("to");
+ const redirect = to_param === null ? DEFAULT_LOGIN_REDIRECT : to_param
if (providerName) {
let scope = {};
if (providerName === "google") {
@@ -22,11 +25,14 @@ export const authProvider: AuthProvider = {
const response = await fetch(url, { method: "GET", },);
const body = await response.json();
- if (to_param) {
- localStorage.setItem("redirect_after_login", to_param);
- }
+
+ localStorage.setItem("redirect_after_login", redirect);
+
window.location.href = body.authorization_url;
- return { success: true };
+ return {
+ success: true,
+ redirectTo: ""
+ };
} else if (email !== undefined && password !== undefined) {
const params = new URLSearchParams({"grant_type": "password", "username": email, "password": password});
const response = await fetch(
@@ -42,7 +48,10 @@ export const authProvider: AuthProvider = {
const user = await response.json();
store_user(user);
- return { success: true };
+ return {
+ success: true,
+ redirectTo: redirect,
+ };
}
}
@@ -60,7 +69,7 @@ export const authProvider: AuthProvider = {
if (get_user() == null) {
return {
authenticated: false,
- redirectTo: "/login",
+ redirectTo: "/auth/login",
logout: true
}
}
@@ -142,7 +151,7 @@ export const authProvider: AuthProvider = {
if (error?.status === 401) {
forget_user();
return {
- redirectTo: "/login",
+ redirectTo: "/auth/login",
logout: true,
error: { message: "Authentication required" },
} as OnErrorResponse;