15.02.2019

This commit is contained in:
Mikolaj 2019-02-15 20:41:15 +01:00
parent a88803ac6f
commit d2bff63605
4 changed files with 46 additions and 0 deletions

View File

@ -79,6 +79,11 @@ func getHtmlPost(rend render.Render, w http.ResponseWriter, r *http.Request) {
"html": helpers.MarkdownToHtml(md),
})
}
func login(rend render.Render) {
rend.HTML(http.StatusOK, "login", &models.Post{})
}
func unescape(s string) interface{} {
return template.HTML(s)
}
@ -104,6 +109,7 @@ func main() {
m.Use(martini.Static("bower_components", staticOptions))
m.Get("/", index)
m.Get("/write", write)
m.Get("/login", login)
m.Get("/edit/:id", edit)
m.Post("/savePost", savePost)
m.Get("/deletePost/:id", deletePost)

8
views/log.html Normal file
View File

@ -0,0 +1,8 @@
<div class="log-form">
<h1>Index</h1>
<hr>
<small>User: %s</small>
<form method="post" action="/logout">
<button type="submit">Logout</button>
</form>
</div>

10
views/login.html Normal file
View File

@ -0,0 +1,10 @@
<div class="log-form">
<h2>Login to your account</h2>
<form method="post" action="/login">
<label for="name">User name</label>
<input type="text" id="name" name="name"> <br />
<label for="password">Password</label>
<input type="password" id="password" name="password"> <br />
<button type="submit">Login</button>
</form>
</div>

22
views/register.html Normal file
View File

@ -0,0 +1,22 @@
<div class="container">
<h1>Register</h1>
<hr>
<small>This is register page</small>
<form method="post" action="/register">
<label for="name">Username</label>
<input type="text" id="username" name="username"> <br />
<label for="name">Email</label>
<input type="text" id="email" name="email"> <br />
<label for="password">password</label>
<input type="password" id="password" name="password"> <br />
<label for="ConfirmPassword">Confirm Password</label>
<input type="password" id="ConfirmPassword" name="ConfirmPassword"> <br />
<button type="submit">Register</button>
</form>
</div>