mirror of
https://github.com/neilalexander/yggmail.git
synced 2026-04-19 00:26:28 +03:00
Add -passwordHash support (#42)
* Update main.go * Update main.go * Set * Set password to db * Main - Password hash, after trimming, cannot be empty * Backend - Assume incoming data is already a hash * Main - CLeaned up * README - Updated command-line argument documentation * Menton this * lower case * SQLITE Driver - Removed comments * Main - `passwordhash` only valiud when non-"" * Main - Try running `Cost([]byte)` on the UTF-8 bytes to verify the hash
This commit is contained in:
committed by
GitHub
parent
59426fabf1
commit
12c153a364
@@ -74,12 +74,8 @@ func (t *TableConfig) ConfigSet(key, value string) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (t *TableConfig) ConfigSetPassword(password string) error {
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return fmt.Errorf("bcrypt.GenerateFromPassword: %w", err)
|
||||
}
|
||||
return t.ConfigSet("password", string(hash))
|
||||
func (t *TableConfig) ConfigSetPassword(passwordHash string) error {
|
||||
return t.ConfigSet("password", passwordHash)
|
||||
}
|
||||
|
||||
func (t *TableConfig) ConfigTryPassword(password string) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user