make ergo genpasswd warn for bad passwords

This commit is contained in:
Shivaram Lingamneni 2021-10-28 19:29:55 -04:00
parent 404bf6c2a0
commit 7d5cb723b4
2 changed files with 8 additions and 4 deletions

View file

@ -128,6 +128,10 @@ Options:
} else {
password = getPassword()
}
if err := irc.ValidatePassphrase(password); err != nil {
log.Printf("WARNING: this password contains characters that may cause problems with your IRC client software.\n")
log.Printf("We strongly recommend choosing a different password.\n")
}
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.MinCost)
if err != nil {
log.Fatal("encoding error:", err.Error())