ssh.go 623 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import (
  6. "fmt"
  7. "net/http"
  8. "github.com/martini-contrib/render"
  9. "github.com/gogits/gogs/models"
  10. )
  11. func AddPublickKey(req *http.Request, r render.Render) {
  12. if req.Method == "GET" {
  13. r.HTML(200, "user/publickey_add", map[string]interface{}{
  14. "Title": "Add Public Key",
  15. })
  16. return
  17. }
  18. k := &models.PublicKey{}
  19. err := models.AddPublicKey(k, "")
  20. r.HTML(403, "status/403", map[string]interface{}{
  21. "Title": fmt.Sprintf("%v", err),
  22. })
  23. }