18 lines
297 B
Go
18 lines
297 B
Go
package security
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
httpHelpers "synlotto-website/internal/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
|
|
}
|