summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-11-23 02:33:47 -0500
committerUnknwon <joe2010xtmf@163.com>2014-11-23 02:33:47 -0500
commit1b66600bd0e9eaa52f2f14f58c9cdf504efadaf5 (patch)
tree1f86ffa41b0b64a6a4bb06dd150998e95d29dbff /models/publickey.go
parentdc53270da91c369cb00f992a600a1e014d555278 (diff)
downloadgitea-1b66600bd0e9eaa52f2f14f58c9cdf504efadaf5.tar.gz
gitea-1b66600bd0e9eaa52f2f14f58c9cdf504efadaf5.zip
Fix #652
Diffstat (limited to 'models/publickey.go')
-rw-r--r--models/publickey.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/publickey.go b/models/publickey.go
index 29c12c6e3b..ba15ca4553 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -89,6 +89,11 @@ type PublicKey struct {
HasUsed bool `xorm:"-"`
}
+// OmitEmail returns content of public key but without e-mail address.
+func (k *PublicKey) OmitEmail() string {
+ return strings.Join(strings.Split(k.Content, " ")[:2], " ")
+}
+
// GetAuthorizedString generates and returns formatted public key string for authorized_keys file.
func (key *PublicKey) GetAuthorizedString() string {
return fmt.Sprintf(_TPL_PUBLICK_KEY, appPath, key.Id, key.Content)