fix: correct api key db guard
This commit is contained in:
@@ -63,3 +63,140 @@ If this is a native custom element, make sure to exclude it from component resol
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 270868ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 274981ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 281038ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 330678ms] [ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://127.0.0.1:9530/app.bc316f375e655c92.hot-update.json:0
|
||||
[ 330940ms] [INFO] 欢迎使用go-admin,谢谢您对我们的支持,在使用过程中如果有什么问题,
|
||||
请访问https://github.com/go-admin-team/go-admin 或者
|
||||
https://github.com/go-admin-team/go-admin-ui 向我们反馈,
|
||||
谢谢! @ http://127.0.0.1:9530/js/app.js:24634
|
||||
[ 330947ms] [WARNING] [Vue warn]: Failed to resolve component: Monitor
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330947ms] [WARNING] [Vue warn]: Failed to resolve component: Lock
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330948ms] [WARNING] [Vue warn]: Failed to resolve component: User
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330948ms] [WARNING] [Vue warn]: Failed to resolve component: View
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330948ms] [WARNING] [Vue warn]: Failed to resolve component: Hide
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330948ms] [WARNING] [Vue warn]: Failed to resolve component: Loading
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: Monitor
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: Lock
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: User
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: View
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: Hide
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 330961ms] [WARNING] [Vue warn]: Failed to resolve component: Loading
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 397955ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 402049ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 408184ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 418274ms] [ERROR] WebSocket connection to 'ws://192.168.0.224:9530/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ http://127.0.0.1:9530/js/chunk-vendors.js:56525
|
||||
[ 434328ms] [ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://127.0.0.1:9530/app.c9a7f192c2f06319.hot-update.json:0
|
||||
[ 434487ms] [INFO] 欢迎使用go-admin,谢谢您对我们的支持,在使用过程中如果有什么问题,
|
||||
请访问https://github.com/go-admin-team/go-admin 或者
|
||||
https://github.com/go-admin-team/go-admin-ui 向我们反馈,
|
||||
谢谢! @ http://127.0.0.1:9530/js/app.js:24634
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: Monitor
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: Lock
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: User
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: View
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: Hide
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434495ms] [WARNING] [Vue warn]: Failed to resolve component: Loading
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: Monitor
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: Lock
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: User
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: View
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: Hide
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
[ 434511ms] [WARNING] [Vue warn]: Failed to resolve component: Loading
|
||||
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
|
||||
at <LoginPage onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) > >
|
||||
at <RouterView>
|
||||
at <App> @ http://127.0.0.1:9530/js/chunk-vendors.js:3921
|
||||
|
||||
@@ -21,7 +21,8 @@ func (e APIKey) List(c *gin.Context) {
|
||||
e.MakeContext(c)
|
||||
db := primaryDB()
|
||||
if db == nil {
|
||||
return false
|
||||
e.Error(500, fmt.Errorf("database is not initialized"), "数据库未初始化")
|
||||
return
|
||||
}
|
||||
rows := make([]models.APIKey, 0)
|
||||
if err := db.Order("id desc").Find(&rows).Error; err != nil {
|
||||
@@ -108,6 +109,9 @@ func ValidateAPIKey(c *gin.Context) bool {
|
||||
h := sha256.Sum256([]byte(v))
|
||||
var row models.APIKey
|
||||
db := primaryDB()
|
||||
if db == nil {
|
||||
return false
|
||||
}
|
||||
if db.Where("key_hash = ? AND enabled = ?", hex.EncodeToString(h[:]), true).First(&row).Error != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user