mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-11 06:29:29 +01:00
validate that passphrases are valid as non-final IRC parameters
This commit is contained in:
parent
67db9f3564
commit
d7ba478519
@ -479,7 +479,11 @@ func validatePassphrase(passphrase string) error {
|
|||||||
if passphrase == "*" {
|
if passphrase == "*" {
|
||||||
return errAccountBadPassphrase
|
return errAccountBadPassphrase
|
||||||
}
|
}
|
||||||
// for now, just enforce that spaces are not allowed
|
// validate that the passphrase contains no spaces, and furthermore is valid as a
|
||||||
|
// non-final IRC parameter. we already checked that it is nonempty:
|
||||||
|
if passphrase[0] == ':' {
|
||||||
|
return errAccountBadPassphrase
|
||||||
|
}
|
||||||
for _, r := range passphrase {
|
for _, r := range passphrase {
|
||||||
if unicode.IsSpace(r) {
|
if unicode.IsSpace(r) {
|
||||||
return errAccountBadPassphrase
|
return errAccountBadPassphrase
|
||||||
|
Loading…
Reference in New Issue
Block a user