aboutsummaryrefslogtreecommitdiff
path: root/pkg/view
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/view')
-rw-r--r--pkg/view/auth.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/view/auth.go b/pkg/view/auth.go
index d44424d..3f9e414 100644
--- a/pkg/view/auth.go
+++ b/pkg/view/auth.go
@@ -68,10 +68,31 @@ func Index(ctx *fasthttp.RequestCtx) {
ctx.Redirect("/login", 307)
}
+func (v *AuthView) InitialRegisterView(ctx *fasthttp.RequestCtx) error {
+ return img.Render[interface{}](ctx, "register.html", nil)
+}
+
+func (v *AuthView) InitialRegister(ctx *fasthttp.RequestCtx) error {
+ username := ctx.FormValue("username")
+ password := ctx.FormValue("password")
+ path := ctx.FormValue("path")
+
+ err := v.userController.InitialRegister(ctx, username, password, path)
+ if err != nil {
+ return err
+ }
+
+ ctx.Redirect("/login", 307)
+ return nil
+}
+
func (v *AuthView) SetMyselfIn(r *ext.Router) {
r.GET("/login", v.LoginView)
r.POST("/login", v.Login)
r.GET("/logout", v.Logout)
r.POST("/logout", v.Logout)
+
+ r.GET("/initial", v.InitialRegisterView)
+ r.POST("/initial", v.InitialRegister)
}