15.02.2019
This commit is contained in:
parent
a88803ac6f
commit
d2bff63605
6
main.go
6
main.go
@ -79,6 +79,11 @@ func getHtmlPost(rend render.Render, w http.ResponseWriter, r *http.Request) {
|
|||||||
"html": helpers.MarkdownToHtml(md),
|
"html": helpers.MarkdownToHtml(md),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func login(rend render.Render) {
|
||||||
|
rend.HTML(http.StatusOK, "login", &models.Post{})
|
||||||
|
}
|
||||||
|
|
||||||
func unescape(s string) interface{} {
|
func unescape(s string) interface{} {
|
||||||
return template.HTML(s)
|
return template.HTML(s)
|
||||||
}
|
}
|
||||||
@ -104,6 +109,7 @@ func main() {
|
|||||||
m.Use(martini.Static("bower_components", staticOptions))
|
m.Use(martini.Static("bower_components", staticOptions))
|
||||||
m.Get("/", index)
|
m.Get("/", index)
|
||||||
m.Get("/write", write)
|
m.Get("/write", write)
|
||||||
|
m.Get("/login", login)
|
||||||
m.Get("/edit/:id", edit)
|
m.Get("/edit/:id", edit)
|
||||||
m.Post("/savePost", savePost)
|
m.Post("/savePost", savePost)
|
||||||
m.Get("/deletePost/:id", deletePost)
|
m.Get("/deletePost/:id", deletePost)
|
||||||
|
8
views/log.html
Normal file
8
views/log.html
Normal 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
10
views/login.html
Normal 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
22
views/register.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user