Skip to content

Commit

Permalink
fix redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
LordLumineer committed May 9, 2024
1 parent 8e97852 commit 1baaefc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions client/components/loginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
const stateParam = currentUri.searchParams.get("state");
window.localStorage.setItem("token", data.access_token);
if (redirectUri) {
window.location.href = `https://eventkit.stream/landing?access_token=${data.access_token}&token_type=${data.token_type}`;
window.location.href = `${redirectUri}?token_type=${data.token_type}&access_token=${data.access_token}&state=${stateParam}`;
return;
}
window.location.href = `${redirectUri}?access_token=${data.access_token}&token_type=${data.token_type}&state=${stateParam}`;
window.location.href = `https://eventkit.stream/landing?token_type=${data.token_type}&access_token=${data.access_token}`;
} else {
isLoading.value = false;
alert("Login Failed: " + data.detail);
Expand Down
4 changes: 2 additions & 2 deletions client/components/registerForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
const stateParam = currentUri.searchParams.get("state");
window.localStorage.setItem("token", data.access_token);
if (redirectUri) {
window.location.href = `https://eventkit.stream/landing?access_token=${data.access_token}&token_type=${data.token_type}`;
window.location.href = `${redirectUri}?token_type=${data.token_type}&access_token=${data.access_token}&state=${stateParam}`;
return;
}
window.location.href = `${redirectUri}?access_token=${data.access_token}&token_type=${data.token_type}&state=${stateParam}`;
window.location.href = `https://eventkit.stream/landing?token_type=${data.token_type}&access_token=${data.access_token}`;
} else {
isLoading.value = false;
alert("Login Failed: " + data.detail);
Expand Down
1 change: 0 additions & 1 deletion docker-compose-FULL_SECRET.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
auth-server:
depends_on:
Expand Down
4 changes: 2 additions & 2 deletions server/assets/html/template/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@
.then((data) => {
if (data.access_token) {
if (redirectUri) {
window.location.href = `${redirectUri}?access_token=${data.access_token}&expires_in=${data.expires_in}&token_type=${data.token_type}&state=${state}`;
window.location.href = `${redirectUri}?token_type=${data.token_type}&access_token=${data.access_token}&state=${stateParam}`;
}
window.location.href = `https://eventkit.stream/landing?access_token=${access_token}&token_type=${token_type}`;
window.location.href = `https://eventkit.stream/landing?token_type=${data.token_type}&access_token=${data.access_token}`;
} else {
loginButton.disabled = false;
loginButton.innerHTML = originalButtonText;
Expand Down
4 changes: 2 additions & 2 deletions server/assets/html/template/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
.then((data) => {
if (data.access_token) {
if (redirectUri) {
window.location.href = `${redirectUri}?access_token=${data.access_token}&expires_in=${data.expires_in}&token_type=${data.token_type}&state=${state}`;
window.location.href = `${redirectUri}?token_type=${data.token_type}&access_token=${data.access_token}&state=${stateParam}`;
}
window.location.href = `https://eventkit.stream/landing?access_token=${access_token}&token_type=${token_type}`;
window.location.href = `https://eventkit.stream/landing?token_type=${data.token_type}&access_token=${data.access_token}`;
} else {
signupButton.disabled = false;
signupButton.innerHTML = originalButtonText;
Expand Down
7 changes: 7 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ def custom_generate_unique_id(route: APIRoute) -> str:

app.include_router(api_router, prefix=settings.API_STR)

@app.get("/", include_in_schema=False, tags=["misc"])
async def root():
"""Root endpoint for the API."""
return RedirectResponse(
url=f"/authorize",
status_code=status.HTTP_307_TEMPORARY_REDIRECT,
)

@app.get("/favicon.ico", include_in_schema=False, tags=["misc"])
async def favicon():
Expand Down

0 comments on commit 1baaefc

Please sign in to comment.