This repository was archived by the owner on Nov 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const (
2323 uiTcpPort = "9999"
2424 managementInternalPath = "/_quesma"
2525 healthPath = managementInternalPath + "/health"
26+ loginWithElasticSearch = "/login-with-elasticsearch"
2627)
2728
2829//go:embed asset/*
@@ -70,7 +71,7 @@ func (qmc *QuesmaManagementConsole) createRouting() *mux.Router {
7071 router .HandleFunc ("/auth/{provider}/callback" , authCallbackHandler )
7172
7273 // our logic for login
73- router .HandleFunc ("/login-with-elasticsearch" , qmc .HandleElasticsearchLogin )
74+ router .HandleFunc (loginWithElasticSearch , qmc .HandleElasticsearchLogin )
7475
7576 authenticatedRoutes := router .PathPrefix ("/" ).Subrouter ()
7677 if qmc .cfg .Elasticsearch .User == "" && qmc .cfg .Elasticsearch .Password == "" {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ func NewElasticsearchAuthProvider() *ElasticsearchAuthProvider {
2525type ElasticsearchSession struct {}
2626
2727func (e ElasticsearchSession ) GetAuthURL () (string , error ) {
28- return "http://localhost:9999/login-with-elasticsearch" , nil
28+ return loginWithElasticSearch , nil
2929}
3030
3131func (e ElasticsearchSession ) Marshal () string {
Original file line number Diff line number Diff line change @@ -85,8 +85,6 @@ func (qmc *QuesmaManagementConsole) generateTopNavigation(target string) []byte
8585 buffer .Html (abTestingPath )
8686 buffer .Html (`">A/B</a></li>` )
8787
88- buffer .Html (`<li><a href="/logout">Logout</a></li>` )
89-
9088 if qmc .isAuthEnabled {
9189 buffer .Html (`<li><a href="/logout">Logout</a></li>` )
9290 }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func (qmc *QuesmaManagementConsole) generateLoginForm() []byte {
2020 buffer .Html (`<div class="login-form">` )
2121 buffer .Html (`<h2>Login</h2>` )
2222 buffer .Html (`<p style="color: #ccc;">Log in to Quesma admin console using your Elasticsearch credentials</p>` )
23- buffer .Html (`<form action="/login-with-elasticsearch " method="post">` )
23+ buffer .Html (`<form action="` ). Text ( loginWithElasticSearch ). Html ( ` " method="post">` )
2424 buffer .Html (`<label for="username">Username:</label>` )
2525 buffer .Html (`<input type="text" id="username" name="username" placeholder="Enter your Elasticsearch username" autofocus>` )
2626 buffer .Html (`<label for="password">Password:</label>` )
@@ -41,6 +41,7 @@ func (qmc *QuesmaManagementConsole) HandleElasticsearchLogin(writer http.Respons
4141 return
4242 }
4343 writer .Header ().Set ("Content-Type" , "text/html" )
44+ writer .Header ().Set ("HX-Redirect" , loginWithElasticSearch )
4445 writer .Write (qmc .generateLoginForm ())
4546 } else if req .Method == http .MethodPost {
4647 username := req .FormValue ("username" )
You can’t perform that action at this time.
0 commit comments