mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
Merge pull request #1571 from slingamn/validation
validate that passphrases are valid as non-final IRC parameters
This commit is contained in:
commit
143e6ba9e3
@ -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