add register tmpl

This commit is contained in:
zhangchao
2024-12-19 10:29:31 +08:00
parent 8de9cf366b
commit f0d2312964
2 changed files with 43 additions and 0 deletions

View File

@@ -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
View 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>