Refactor and remove sqlite and replace with MySQL
This commit is contained in:
17
internal/helpers/security/users.go
Normal file
17
internal/helpers/security/users.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package security
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
httpHelpers "synlotto-website/helpers/http"
|
||||
)
|
||||
|
||||
func GetCurrentUserID(r *http.Request) (int, bool) {
|
||||
session, err := httpHelpers.GetSession(nil, r)
|
||||
if err != nil {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
id, ok := session.Values["user_id"].(int)
|
||||
return id, ok
|
||||
}
|
||||
Reference in New Issue
Block a user