add register tmpl
This commit is contained in:
6
main.go
6
main.go
@@ -101,6 +101,12 @@ func registerRoutes(r *gin.Engine) {
|
||||
"user": user,
|
||||
})
|
||||
})
|
||||
r.GET("/register", func(c *gin.Context) {
|
||||
c.HTML(200, "register.tmpl", map[string]interface{}{
|
||||
"title": "这个是titile,传入templates中的",
|
||||
"user": user,
|
||||
})
|
||||
})
|
||||
|
||||
r.GET("/ws", controllers.WebSocketHandler)
|
||||
r.POST("/content", controllers.CreateContentHandler)
|
||||
|
||||
37
templates/register.tmpl
Normal file
37
templates/register.tmpl
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
<div class="typecho-login-wrap">
|
||||
<div class="typecho-login">
|
||||
<h1><a href="login.html" class="i-logo">登录</a></h1>
|
||||
<form action="login" method="post" name="login" role="form">
|
||||
<p>
|
||||
<label for="name" class="sr-only">{{.user.Name}}</label>
|
||||
<input type="text" id="name" name="username" value="{{.user.Name}}" placeholder="{{.User.Name}}" class="text-l w-100" autofocus />
|
||||
</p>
|
||||
<p>
|
||||
<label for="password" class="sr-only">{{.user.Password}}</label>
|
||||
<input type="password" id="password" name="password" class="text-l w-100" placeholder="{{.user.Password}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="conformPassword" class="sr-only">{{.user.ConformPassword}}</label>
|
||||
<input type="conformPassword" id="conformPassword" name="conformPassword" class="text-l w-100" placeholder="{{.user.ConformPassword}}" />
|
||||
</p>
|
||||
<p class="submit">
|
||||
<button type="submit" class="btn btn-l w-100 primary">'登录'</button>
|
||||
<input type="hidden" name="referer" value="'referer'" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="remember">
|
||||
<input type="checkbox" name="remember" class="checkbox" value="1" id="remember" /> '下次自动登录'
|
||||
</label>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#name').focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user