mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
feat(auth): change password and username (#1295)
* feat(backend): added change password api endpoint. * feat(web): added profile UI to change password. I think we can change the username too, but I don't know if we should for now disabled the username field. * refactor: don't leak username or password. * refactor: protect the route. * generic * feat: add ChangeUsername * fix(tests): speculative fix for TestUserRepo_Update * Revert "feat: add ChangeUsername" This reverts commit d4c1645002883a278aa45dec3c8c19fa1cc75d9b. * refactor into 1 endpoint that handles both * feat: added option to change username as well. :pain: * refactor: frontend * refactor: function names in backend I think this makes it more clear what their function is * fix: change to 2 cols with separator * refactor: update user * fix: test db create user --------- Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com> Co-authored-by: soup <soup@r4tio.dev> Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com> Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
d898b3cd8d
commit
df2612602b
17 changed files with 390 additions and 57 deletions
|
@ -9,7 +9,7 @@ type UserRepo interface {
|
|||
GetUserCount(ctx context.Context) (int, error)
|
||||
FindByUsername(ctx context.Context, username string) (*User, error)
|
||||
Store(ctx context.Context, req CreateUserRequest) error
|
||||
Update(ctx context.Context, user User) error
|
||||
Update(ctx context.Context, req UpdateUserRequest) error
|
||||
Delete(ctx context.Context, username string) error
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,14 @@ type User struct {
|
|||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UpdateUserRequest struct {
|
||||
UsernameCurrent string `json:"username_username"`
|
||||
UsernameNew string `json:"username_new"`
|
||||
PasswordCurrent string `json:"password_current"`
|
||||
PasswordNew string `json:"password_new"`
|
||||
PasswordNewHash string `json:"-"`
|
||||
}
|
||||
|
||||
type CreateUserRequest struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue