Browse Source

change auth header name, make auth basic work

pull/42/head
vx3r 5 months ago
parent
commit
7e2146a229
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      cmd/wg-gen-web/main.go
  2. +1
    -1
      ui/src/services/api.service.js
  3. +1
    -1
      util/util.go

+ 1
- 1
cmd/wg-gen-web/main.go View File

@@ -90,7 +90,7 @@ func main() {
// cors middleware
config := cors.DefaultConfig()
config.AllowAllOrigins = true
config.AddAllowHeaders("Authorization")
config.AddAllowHeaders("Authorization", util.AuthTokenHeaderName)
app.Use(cors.New(config))

// protection middleware


+ 1
- 1
ui/src/services/api.service.js View File

@@ -4,7 +4,7 @@ import TokenService from "./token.service";
const ApiService = {

setHeader() {
Vue.axios.defaults.headers.common.Authorization = `${TokenService.getToken()}`;
Vue.axios.defaults.headers['x-wg-gen-web-auth'] = `${TokenService.getToken()}`;
},

get(resource) {


+ 1
- 1
util/util.go View File

@@ -11,7 +11,7 @@ import (
)

var (
AuthTokenHeaderName = "Authorization"
AuthTokenHeaderName = "x-wg-gen-web-auth"
// RegexpEmail check valid email
RegexpEmail = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
)


Loading…
Cancel
Save