summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-27 17:01:39 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-27 17:01:39 -0400
commit41b0a7b97c2cc1ffd8751fd12690642968961d0e (patch)
treee3c681c2147fc772629923410bd44b324adf9e6e /models/publickey.go
parent62240b6bc12abfe257224bb554a75a5712803059 (diff)
downloadgitea-41b0a7b97c2cc1ffd8751fd12690642968961d0e.tar.gz
gitea-41b0a7b97c2cc1ffd8751fd12690642968961d0e.zip
Mirror fix on public key
Diffstat (limited to 'models/publickey.go')
-rw-r--r--models/publickey.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/publickey.go b/models/publickey.go
index ed47ff209d..b80412812b 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -77,12 +77,12 @@ func init() {
// PublicKey represents a SSH key of user.
type PublicKey struct {
Id int64
- OwnerId int64 `xorm:"unique(s) index not null"`
- Name string `xorm:"unique(s) not null"`
+ OwnerId int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
+ Name string `xorm:"UNIQUE(s) NOT NULL"`
Fingerprint string
- Content string `xorm:"TEXT not null"`
- Created time.Time `xorm:"created"`
- Updated time.Time `xorm:"updated"`
+ Content string `xorm:"TEXT NOT NULL"`
+ Created time.Time `xorm:"CREATED"`
+ Updated time.Time `xorm:"UPDATED"`
}
// GenAuthorizedKey returns formatted public key string.
@@ -107,9 +107,9 @@ func AddPublicKey(key *PublicKey) (err error) {
if err = ioutil.WriteFile(tmpPath, []byte(key.Content), os.ModePerm); err != nil {
return err
}
- stdout, _, err := com.ExecCmd("ssh-keygen", "-l", "-f", tmpPath)
+ stdout, stderr, err := com.ExecCmd("ssh-keygen", "-l", "-f", tmpPath)
if err != nil {
- return err
+ return errors.New("ssh-keygen -l -f: " + stderr)
} else if len(stdout) < 2 {
return errors.New("Not enough output for calculating fingerprint")
}