summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-03-16 10:35:18 +0530
committersinanmohd <sinan@sinanmohd.com>2024-03-16 10:35:18 +0530
commitfb387fe290d907dd8a1b0e3600c5468043071628 (patch)
tree228430b4d95ea2582c1d31bff49de6b59dbbe946 /db
parent8fd42493709792ffe85f519c75b085ed65123baa (diff)
api/login: init
Diffstat (limited to 'db')
-rw-r--r--db/account.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/db/account.go b/db/account.go
index b7bcaa0..c7f76bf 100644
--- a/db/account.go
+++ b/db/account.go
@@ -4,7 +4,7 @@ import "errors"
type Account struct {
UserName string
- PassHash string
+ PassHash string `json:",omitempty"`
Info *Login
}
@@ -69,9 +69,10 @@ func (ac *Account) Login(safe *SafeDB) error {
if err != nil {
return err
}
- if PassHash != ac.PassHash {
+ if PassHash != ToBlake3(ac.PassHash) {
return errors.New("Auth failed")
}
+ ac.PassHash = ""
err = ac.Info.Bearer.Generate(safe, ac.Info)
if err != nil {