mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-08 19:48:35 +00:00
email improvements
This commit is contained in:
parent
6fd8457e5a
commit
29e30bfaba
47 changed files with 3710 additions and 95 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hay-kot/homebox/backend/internal/data/ent"
|
||||
"github.com/hay-kot/homebox/backend/internal/data/ent/actiontoken"
|
||||
"github.com/hay-kot/homebox/backend/internal/data/ent/user"
|
||||
)
|
||||
|
||||
|
@ -133,3 +134,18 @@ func (r *UserRepository) GetSuperusers(ctx context.Context) ([]*ent.User, error)
|
|||
func (r *UserRepository) ChangePassword(ctx context.Context, UID uuid.UUID, pw string) error {
|
||||
return r.db.User.UpdateOneID(UID).SetPassword(pw).Exec(ctx)
|
||||
}
|
||||
|
||||
func (r *UserRepository) PasswordResetCreate(ctx context.Context, UID uuid.UUID, token []byte) error {
|
||||
return r.db.ActionToken.Create().
|
||||
SetUserID(UID).
|
||||
SetToken(token).
|
||||
SetAction(actiontoken.ActionResetPassword).
|
||||
Exec(ctx)
|
||||
}
|
||||
|
||||
func (r *UserRepository) PasswordResetGet(ctx context.Context, token []byte) (*ent.ActionToken, error) {
|
||||
return r.db.ActionToken.Query().
|
||||
Where(actiontoken.Token(token)).
|
||||
WithUser().
|
||||
Only(ctx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue