Revert 'autogenerate token.'

This commit is contained in:
Miroslav Šedivý 2021-03-13 22:54:34 +01:00
parent 3fcca6ab52
commit cacdd9e20a
4 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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)