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.
|
||||
// data.ID
|
||||
|
||||
session, _, err := h.sessions.Create(*data.MemberProfile)
|
||||
session, _, err := h.sessions.Create(data.ID, *data.MemberProfile)
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
|
@ -31,7 +31,7 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// TODO: Proper login.
|
||||
session, token, err := api.sessions.Create(types.MemberProfile{
|
||||
session, token, err := api.sessions.Create(data.ID, types.MemberProfile{
|
||||
Name: data.ID,
|
||||
IsAdmin: true,
|
||||
CanLogin: true,
|
||||
|
@ -37,12 +37,7 @@ type SessionManagerCtx struct {
|
||||
emmiter events.EventEmmiter
|
||||
}
|
||||
|
||||
func (manager *SessionManagerCtx) Create(profile types.MemberProfile) (types.Session, string, error) {
|
||||
id, err := utils.NewUID(32)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
func (manager *SessionManagerCtx) Create(id string, profile types.MemberProfile) (types.Session, string, error) {
|
||||
token, err := utils.NewUID(64)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
|
@ -59,7 +59,7 @@ type Session interface {
|
||||
}
|
||||
|
||||
type SessionManager interface {
|
||||
Create(profile MemberProfile) (Session, string, error)
|
||||
Create(id string, profile MemberProfile) (Session, string, error)
|
||||
Update(id string, profile MemberProfile) error
|
||||
Delete(id string) error
|
||||
Get(id string) (Session, bool)
|
||||
|
Loading…
Reference in New Issue
Block a user