refactor: init v3
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"github.com/Xhofe/alist/conf"
|
||||
"github.com/Xhofe/alist/server/common"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Auth(c *gin.Context) {
|
||||
token := c.GetHeader("Authorization")
|
||||
//password, err := model.GetSettingByKey("password")
|
||||
//if err != nil {
|
||||
// if err == gorm.ErrRecordNotFound {
|
||||
// common.ErrorResp(c, fmt.Errorf("password not set"), 400)
|
||||
// return
|
||||
// }
|
||||
// common.ErrorResp(c, err, 500)
|
||||
// return
|
||||
//}
|
||||
//if token != utils.GetMD5Encode(password.Value) {
|
||||
if token != conf.Token {
|
||||
common.ErrorStrResp(c, "Invalid token", 401)
|
||||
return
|
||||
}
|
||||
c.Next()
|
||||
}
|
Reference in New Issue
Block a user