diff options
Diffstat (limited to 'pkg/service')
-rw-r--r-- | pkg/service/auth.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pkg/service/auth.go b/pkg/service/auth.go index f27cf88..30e574a 100644 --- a/pkg/service/auth.go +++ b/pkg/service/auth.go @@ -105,7 +105,7 @@ func (u *AuthController) Upsert( ) error { if id != nil { if err := u.userRepository.Update(ctx, *id, &repository.UpdateUser{ - Username: string(username), + Username: username, Name: name, IsAdmin: isAdmin, Path: path, @@ -140,10 +140,15 @@ func (u *AuthController) Upsert( return err } -type Token struct { - UserID uint - Username string -} +type ( + AuthKey string + Token struct { + UserID uint + Username string + } +) + +const TokenKey AuthKey = "token" func ReadToken(data []byte, key []byte) (*Token, error) { block, err := aes.NewCipher(key) |