mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
fix #193 - auth middleware bug
This commit is contained in:
parent
411f612b85
commit
324b6c9ee0
@ -15,7 +15,7 @@ import (
|
|||||||
func authentication(c *gin.Context) {
|
func authentication(c *gin.Context) {
|
||||||
var userID int
|
var userID int
|
||||||
|
|
||||||
if authHeader := strings.ToLower(c.Request.Header.Get("authorization")); len(authHeader) > 0 {
|
if authHeader := strings.ToLower(c.Request.Header.Get("authorization")); len(authHeader) > 0 && strings.Contains(authHeader, "bearer") {
|
||||||
var token models.APIToken
|
var token models.APIToken
|
||||||
if err := database.Mysql.SelectOne(&token, "select * from user__token where id=? and expired=0", strings.Replace(authHeader, "bearer ", "", 1)); err != nil {
|
if err := database.Mysql.SelectOne(&token, "select * from user__token where id=? and expired=0", strings.Replace(authHeader, "bearer ", "", 1)); err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
|
Loading…
Reference in New Issue
Block a user