更新用户名后删除缓存

This commit is contained in:
xmdhs 2023-10-06 01:42:00 +08:00
parent f24cefe002
commit 2444b5cacc
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95

View File

@ -140,7 +140,7 @@ func (w *WebService) ChangePasswd(ctx context.Context, p model.ChangePasswd, tok
return nil
}
func (w *WebService) changeName(ctx context.Context, newName string, uid int) error {
func (w *WebService) changeName(ctx context.Context, newName string, uid int, uuid string) error {
if w.config.OfflineUUID {
return fmt.Errorf("changeName: %w", ErrChangeName)
}
@ -155,6 +155,7 @@ func (w *WebService) changeName(ctx context.Context, newName string, uid int) er
if err != nil {
return fmt.Errorf("changeName: %w", err)
}
w.cache.Del([]byte("Profile" + uuid))
return err
}
@ -163,7 +164,7 @@ func (w *WebService) ChangeName(ctx context.Context, newName string, token strin
if err != nil {
return fmt.Errorf("ChangeName: %w", err)
}
err = w.changeName(ctx, newName, t.UID)
err = w.changeName(ctx, newName, t.UID, t.Subject)
if err != nil {
return fmt.Errorf("ChangeName: %w", err)
}