summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/error.go2
-rw-r--r--models/user.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/models/error.go b/models/error.go
index febe3f3e04..c3495b28d7 100644
--- a/models/error.go
+++ b/models/error.go
@@ -318,7 +318,7 @@ func IsErrKeyAlreadyExist(err error) bool {
}
func (err ErrKeyAlreadyExist) Error() string {
- return fmt.Sprintf("public key already exists [owner_id: %d, finter_print: %s, content: %s]",
+ return fmt.Sprintf("public key already exists [owner_id: %d, finger_print: %s, content: %s]",
err.OwnerID, err.Fingerprint, err.Content)
}
diff --git a/models/user.go b/models/user.go
index 31e2387feb..04fe36ffa0 100644
--- a/models/user.go
+++ b/models/user.go
@@ -1526,7 +1526,11 @@ func addLdapSSHPublicKeys(usr *User, s *LoginSource, SSHPublicKeys []string) boo
if err == nil {
sshKeyName := fmt.Sprintf("%s-%s", s.Name, sshKey[0:40])
if _, err := AddPublicKey(usr.ID, sshKeyName, sshKey, s.ID); err != nil {
- log.Error("addLdapSSHPublicKeys[%s]: Error adding LDAP Public SSH Key for user %s: %v", s.Name, usr.Name, err)
+ if IsErrKeyAlreadyExist(err) {
+ log.Trace("addLdapSSHPublicKeys[%s]: LDAP Public SSH Key %s already exists for user", s.Name, usr.Name)
+ } else {
+ log.Error("addLdapSSHPublicKeys[%s]: Error adding LDAP Public SSH Key for user %s: %v", s.Name, usr.Name, err)
+ }
} else {
log.Trace("addLdapSSHPublicKeys[%s]: Added LDAP Public SSH Key for user %s", s.Name, usr.Name)
sshKeysNeedUpdate = true