1
0
Fork 0
forked from forgejo/forgejo
This commit is contained in:
Unknwon 2014-11-23 02:33:47 -05:00
parent dc53270da9
commit 1b66600bd0
4 changed files with 36 additions and 29 deletions

View file

@ -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)