user.go 823 B

1234567891011121314151617181920212223242526272829303132333435363738
  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/utils/log"
  10. "github.com/gogits/gogs/models"
  11. )
  12. func SignIn(r render.Render) {
  13. r.Redirect("/user/signup", 302)
  14. }
  15. func SignUp(req *http.Request, r render.Render) {
  16. if req.Method == "GET" {
  17. r.HTML(200, "user/signup", map[string]interface{}{
  18. "Title": "Sign Up",
  19. })
  20. return
  21. }
  22. // TODO: validate form.
  23. err := models.RegisterUser(&models.User{
  24. Name: req.FormValue("username"),
  25. Email: req.FormValue("email"),
  26. Passwd: req.FormValue("passwd"),
  27. })
  28. r.HTML(403, "status/403", map[string]interface{}{
  29. "Title": fmt.Sprintf("%v", err),
  30. })
  31. }