mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
fix: logout link is broken (#5698)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
This commit is contained in:
parent
c0985fb0c9
commit
e3163e317a
2 changed files with 12 additions and 2 deletions
|
|
@ -63,7 +63,14 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
logoutRedirectURL := strings.TrimRight(strings.TrimLeft(argoCDSettings.URL, "/"), "/") + strings.TrimRight(strings.TrimLeft(h.rootPath, "/"), "/")
|
||||
argoURL := argoCDSettings.URL
|
||||
if argoURL == "" {
|
||||
// golang does not provide any easy way to determine scheme of current request
|
||||
// so redirecting ot http which will auto-redirect too https if necessary
|
||||
argoURL = fmt.Sprintf("http://%s", r.Host)
|
||||
}
|
||||
|
||||
logoutRedirectURL := strings.TrimRight(strings.TrimLeft(argoURL, "/"), "/") + strings.TrimRight(strings.TrimLeft(h.rootPath, "/"), "/")
|
||||
|
||||
cookies := r.Cookies()
|
||||
tokenString, err = httputil.JoinCookies(common.AuthCookieName, cookies)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import {DataLoader, Page as ArgoPage, Toolbar, Utils} from 'argo-ui';
|
||||
import * as React from 'react';
|
||||
import {BehaviorSubject, Observable} from 'rxjs';
|
||||
|
||||
import {Context, ContextApis} from '../../context';
|
||||
import {services} from '../../services';
|
||||
import requests from '../../services/requests';
|
||||
|
||||
const mostRecentLoggedIn = new BehaviorSubject<boolean>(false);
|
||||
|
||||
import './page.scss';
|
||||
|
|
@ -20,7 +23,7 @@ export const AddAuthToToolbar = (init: Toolbar | Observable<Toolbar>, ctx: Conte
|
|||
<DataLoader key='loginPanel' load={() => isLoggedIn()}>
|
||||
{loggedIn =>
|
||||
loggedIn ? (
|
||||
<a key='logout' onClick={() => ctx.navigation.goto('/auth/logout')}>
|
||||
<a key='logout' onClick={() => (window.location.href = requests.toAbsURL('/auth/logout'))}>
|
||||
Log out
|
||||
</a>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Reference in a new issue