Skip to content

Commit

Permalink
Merge pull request #116 from ubccr/fix-write-error
Browse files Browse the repository at this point in the history
Fix sshpubkey update errors
  • Loading branch information
aebruno authored Jan 27, 2023
2 parents b7d3353 + cc93dba commit 53da4fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Mokey ChangeLog

## [v0.6.2] - 2023-01-26

- Fix sshpubkey update bug

## [v0.6.1] - 2023-01-26

- Fix account settings update bug
Expand Down Expand Up @@ -114,3 +118,4 @@
[v0.5.6]: https://github.com/ubccr/mokey/releases/tag/v0.5.6
[v0.6.0]: https://github.com/ubccr/mokey/releases/tag/v0.6.0
[v0.6.1]: https://github.com/ubccr/mokey/releases/tag/v0.6.1
[v0.6.2]: https://github.com/ubccr/mokey/releases/tag/v0.6.2
8 changes: 3 additions & 5 deletions server/sshpubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package server
import (
"github.com/gofiber/fiber/v2"
log "github.com/sirupsen/logrus"
"github.com/ubccr/goipa"
ipa "github.com/ubccr/goipa"
)

func (r *Router) SSHKeyList(c *fiber.Ctx) error {
Expand All @@ -21,7 +21,6 @@ func (r *Router) SSHKeyModal(c *fiber.Ctx) error {

func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {
user := r.user(c)
client := r.userClient(c)

title := c.FormValue("title")
key := c.FormValue("key")
Expand All @@ -46,7 +45,7 @@ func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {

user.AddSSHAuthorizedKey(authKey)

user, err = client.UserMod(user)
user, err = r.adminClient.UserMod(user)
if err != nil {
return err
}
Expand All @@ -66,13 +65,12 @@ func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {

func (r *Router) SSHKeyRemove(c *fiber.Ctx) error {
fp := c.FormValue("fp")
client := r.userClient(c)
user := r.user(c)

user.RemoveSSHAuthorizedKey(fp)

var err error
user, err = client.UserMod(user)
user, err = r.adminClient.UserMod(user)
if err != nil {
return err
}
Expand Down

0 comments on commit 53da4fa

Please sign in to comment.