untie session id to saved aliases
This commit is contained in:
parent
4ae0a484f4
commit
448fdffbd0
@ -346,17 +346,13 @@ func (das *DevAccountService) saveAlias(ctx context.Context, alias map[string]st
|
|||||||
if das.db == nil {
|
if das.db == nil {
|
||||||
return fmt.Errorf("Db cannot be nil")
|
return fmt.Errorf("Db cannot be nil")
|
||||||
}
|
}
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unresolved session id")
|
|
||||||
}
|
|
||||||
for k, v := range alias {
|
for k, v := range alias {
|
||||||
k_ := das.prefixKeyFor("alias", k)
|
k_ := das.prefixKeyFor("alias", k)
|
||||||
v_, err := json.Marshal(v)
|
v_, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
das.db.SetSession(sessionId)
|
das.db.SetSession("")
|
||||||
das.db.SetPrefix(db.DATATYPE_USERDATA)
|
das.db.SetPrefix(db.DATATYPE_USERDATA)
|
||||||
return das.db.Put(ctx, []byte(k_), v_)
|
return das.db.Put(ctx, []byte(k_), v_)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user