add confirmation to delete ssh key
This commit is contained in:
parent
9b01a3501b
commit
062adbed8a
9 changed files with 169 additions and 121 deletions
|
@ -466,7 +466,15 @@ func deletePublicKey(e *xorm.Session, key *PublicKey) error {
|
|||
}
|
||||
|
||||
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
|
||||
func DeletePublicKey(key *PublicKey) (err error) {
|
||||
func DeletePublicKey(id int64) (err error) {
|
||||
key := &PublicKey{ID: id}
|
||||
has, err := x.Id(key.ID).Get(key)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
return nil
|
||||
}
|
||||
|
||||
sess := x.NewSession()
|
||||
defer sessionRelease(sess)
|
||||
if err = sess.Begin(); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue