Fix login via navbar (#3962)

This commit is contained in:
Anbraten 2024-07-23 13:46:22 +02:00 committed by GitHub
parent 1c7c87b8f0
commit 9948163e6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -31,7 +31,7 @@
<IconButton v-if="user" :to="{ name: 'user' }" :title="$t('user.settings.settings')" class="navbar-icon !p-1.5"> <IconButton v-if="user" :to="{ name: 'user' }" :title="$t('user.settings.settings')" class="navbar-icon !p-1.5">
<img v-if="user && user.avatar_url" class="rounded-md" :src="`${user.avatar_url}`" /> <img v-if="user && user.avatar_url" class="rounded-md" :src="`${user.avatar_url}`" />
</IconButton> </IconButton>
<Button v-else :text="$t('login')" @click="doLogin" /> <Button v-else :text="$t('login')" :to="`/login?url=${route.fullPath}`" />
</div> </div>
</nav> </nav>
</template> </template>
@ -55,10 +55,6 @@ const authentication = useAuthentication();
const { user } = authentication; const { user } = authentication;
const apiUrl = `${config.rootPath ?? ''}/swagger/index.html`; const apiUrl = `${config.rootPath ?? ''}/swagger/index.html`;
function doLogin() {
authentication.authenticate(route.fullPath);
}
const { enableSwagger } = config; const { enableSwagger } = config;
</script> </script>

View file

@ -12,6 +12,6 @@ export default () =>
const config = useUserConfig(); const config = useUserConfig();
config.setUserConfig('redirectUrl', url); config.setUserConfig('redirectUrl', url);
} }
window.location.href = `${useConfig().rootPath}/authorize?forge_id=${forgeId}`; window.location.href = `${useConfig().rootPath}/authorize?${forgeId !== undefined ? `forgeId=${forgeId}` : ''}`;
}, },
}) as const; }) as const;