aboutsummaryrefslogtreecommitdiffstats
path: root/identity
diff options
context:
space:
mode:
Diffstat (limited to 'identity')
-rw-r--r--identity/version.go22
1 files changed, 6 insertions, 16 deletions
diff --git a/identity/version.go b/identity/version.go
index 1c35831e..9a52d089 100644
--- a/identity/version.go
+++ b/identity/version.go
@@ -4,7 +4,6 @@ import (
"crypto/rand"
"encoding/json"
"fmt"
- "strings"
"time"
"github.com/pkg/errors"
@@ -186,25 +185,16 @@ func (v *version) Validate() error {
if text.Empty(v.name) && text.Empty(v.login) {
return fmt.Errorf("either name or login should be set")
}
- if strings.Contains(v.name, "\n") {
- return fmt.Errorf("name should be a single line")
- }
- if !text.Safe(v.name) {
- return fmt.Errorf("name is not fully printable")
+ if !text.SafeOneLine(v.name) {
+ return fmt.Errorf("name has unsafe characters")
}
- if strings.Contains(v.login, "\n") {
- return fmt.Errorf("login should be a single line")
- }
- if !text.Safe(v.login) {
- return fmt.Errorf("login is not fully printable")
+ if !text.SafeOneLine(v.login) {
+ return fmt.Errorf("login has unsafe characters")
}
- if strings.Contains(v.email, "\n") {
- return fmt.Errorf("email should be a single line")
- }
- if !text.Safe(v.email) {
- return fmt.Errorf("email is not fully printable")
+ if !text.SafeOneLine(v.email) {
+ return fmt.Errorf("email has unsafe characters")
}
if v.avatarURL != "" && !text.ValidUrl(v.avatarURL) {