parent
373f567773
commit
8d75b75af7
6 changed files with 57 additions and 20 deletions
|
@ -21,6 +21,7 @@ type Account struct {
|
|||
LastLogin time.Time `json:"last_login"`
|
||||
Settings *Settings `json:"settings"`
|
||||
PasswordReset *uuid.UUID `json:"password_reset"`
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
||||
func (account *Account) CheckPassword(password string) bool {
|
||||
|
@ -28,6 +29,13 @@ func (account *Account) CheckPassword(password string) bool {
|
|||
return subtle.ConstantTimeCompare(hash, account.PasswordHash) == 1
|
||||
}
|
||||
|
||||
func (account *Account) MarkForDeletion() {
|
||||
account.Salt = nil
|
||||
account.PasswordHash = nil
|
||||
account.PasswordReset = nil
|
||||
account.Deleted = true
|
||||
}
|
||||
|
||||
func (account *Account) ResetPassword() error {
|
||||
var passwordReset uuid.UUID
|
||||
if err := passwordReset.Generate(uuid.V4); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue