fixed viewing invisible releases with admin session
This commit is contained in:
parent
1efe52a8cb
commit
70825ae875
5 changed files with 46 additions and 36 deletions
|
@ -2,7 +2,6 @@ package controller
|
|||
|
||||
import (
|
||||
"arimelody-web/model"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
|
@ -77,19 +76,6 @@ func GetAccountBySession(db *sqlx.DB, sessionToken string) (*model.Account, erro
|
|||
return &account, nil
|
||||
}
|
||||
|
||||
func GetSessionFromRequest(db *sqlx.DB, r *http.Request) string {
|
||||
tokenStr := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ")
|
||||
if len(tokenStr) > 0 {
|
||||
return tokenStr
|
||||
}
|
||||
|
||||
cookie, err := r.Cookie(model.COOKIE_TOKEN)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return cookie.Value
|
||||
}
|
||||
|
||||
func CreateAccount(db *sqlx.DB, account *model.Account) error {
|
||||
err := db.Get(
|
||||
&account.ID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue