dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 222f955732ac328aff6b314c4070e20947fbd3f5
parent e34d073f0259e40f57df4643d0ba8030c3f01bbc
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon,  1 Jan 2024 18:09:29 -0500

cleanup

Diffstat:
Mpkg/database/tableUsers.go | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pkg/database/tableUsers.go b/pkg/database/tableUsers.go @@ -367,6 +367,10 @@ func (u *User) ToggleAutocompleteCommandsEnabled(db *DkfDB) { db.db.Model(u).Select("AutocompleteCommandsEnabled").Updates(User{AutocompleteCommandsEnabled: !u.AutocompleteCommandsEnabled}) } +func (u *User) SetIsUnderDuress(db *DkfDB, isUnderDuress bool) { + db.db.Model(u).Select("IsUnderDuress").Updates(User{IsUnderDuress: isUnderDuress}) +} + func (u *User) SetCaptchaRequired(db *DkfDB, captchaRequired bool) { db.db.Model(u).Select("CaptchaRequired").Updates(User{CaptchaRequired: captchaRequired}) } @@ -589,11 +593,9 @@ func (u *User) CheckPassword(db *DkfDB, password string) bool { if err := bcrypt.CompareHashAndPassword([]byte(u.DuressPassword), []byte(password)); err != nil { return false } - u.IsUnderDuress = true - u.DoSave(db) + u.SetIsUnderDuress(db, true) } else { - u.IsUnderDuress = false - u.DoSave(db) + u.SetIsUnderDuress(db, false) } return true }