Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions meta_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
"time"

"github.com/boltdb/bolt"

"crypto/sha1"
"encoding/hex"
)

// MetaStore implements a metadata storage. It stores user credentials and Meta information
Expand Down Expand Up @@ -316,7 +319,10 @@ func (s *MetaStore) AddUser(user, pass string) error {
return errNoBucket
}

err := bucket.Put([]byte(user), []byte(pass))
pass_sha1b := sha1.Sum([]byte(pass))
pass_sha1 := hex.EncodeToString(pass_sha1b[:])

err := bucket.Put([]byte(user), []byte(pass_sha1))
if err != nil {
return err
}
Expand Down Expand Up @@ -439,5 +445,8 @@ func (s *MetaStore) Authenticate(user, password string) (string, bool) {
return nil
})

return user, value != "" && value == password
pass_sha1b := sha1.Sum([]byte(password))
pass_sha1 := hex.EncodeToString(pass_sha1b[:])

return user, value != "" && value == pass_sha1
}