mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Revert 'autogenerate token.'
This commit is contained in:
parent
3fcca6ab52
commit
cacdd9e20a
@ -65,10 +65,7 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor.
|
session, _, err := h.sessions.Create(data.ID, *data.MemberProfile)
|
||||||
// data.ID
|
|
||||||
|
|
||||||
session, _, err := h.sessions.Create(*data.MemberProfile)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.HttpInternalServerError(w, err)
|
utils.HttpInternalServerError(w, err)
|
||||||
return
|
return
|
||||||
|
@ -31,7 +31,7 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Proper login.
|
// TODO: Proper login.
|
||||||
session, token, err := api.sessions.Create(types.MemberProfile{
|
session, token, err := api.sessions.Create(data.ID, types.MemberProfile{
|
||||||
Name: data.ID,
|
Name: data.ID,
|
||||||
IsAdmin: true,
|
IsAdmin: true,
|
||||||
CanLogin: true,
|
CanLogin: true,
|
||||||
|
@ -37,12 +37,7 @@ type SessionManagerCtx struct {
|
|||||||
emmiter events.EventEmmiter
|
emmiter events.EventEmmiter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *SessionManagerCtx) Create(profile types.MemberProfile) (types.Session, string, error) {
|
func (manager *SessionManagerCtx) Create(id string, profile types.MemberProfile) (types.Session, string, error) {
|
||||||
id, err := utils.NewUID(32)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
token, err := utils.NewUID(64)
|
token, err := utils.NewUID(64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
|
@ -59,11 +59,11 @@ type Session interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SessionManager interface {
|
type SessionManager interface {
|
||||||
Create(profile MemberProfile) (Session, string, error)
|
Create(id string, profile MemberProfile) (Session, string, error)
|
||||||
Update(id string, profile MemberProfile) error
|
Update(id string, profile MemberProfile) error
|
||||||
Delete(id string) error
|
Delete(id string) error
|
||||||
Get(id string) (Session, bool)
|
Get(id string) (Session, bool)
|
||||||
GetByToken(token string) (Session, bool)
|
GetByToken(token string) (Session, bool)
|
||||||
List() []Session
|
List() []Session
|
||||||
|
|
||||||
SetHost(host Session)
|
SetHost(host Session)
|
||||||
|
Loading…
Reference in New Issue
Block a user