06.03.2019v2
This commit is contained in:
parent
27ee05ae64
commit
9aa3ad0bd9
7
main.go
7
main.go
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/martini-contrib/render"
|
"github.com/martini-contrib/render"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"github.com/satori/go.uuid"
|
"github.com/satori/go.uuid"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type user struct {
|
type user struct {
|
||||||
@ -147,7 +148,7 @@ func login(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
func signup(w http.ResponseWriter, req *http.Request) {
|
func signup(w http.ResponseWriter, req *http.Request) {
|
||||||
if alreadyLoggedIn(req) {
|
if alreadyLoggedIn(req) {
|
||||||
http.Redirect(w, req, "/index1", http.StatusSeeOther)
|
http.Redirect(w, req, "/login", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var u user
|
var u user
|
||||||
@ -180,7 +181,7 @@ func signup(w http.ResponseWriter, req *http.Request) {
|
|||||||
u = user{un, bs, f, l}
|
u = user{un, bs, f, l}
|
||||||
dbUsers[un] = u
|
dbUsers[un] = u
|
||||||
// redirect
|
// redirect
|
||||||
http.Redirect(w, req, "/index1", http.StatusSeeOther)
|
http.Redirect(w, req, "/login", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tpl.ExecuteTemplate(w, "signup.html", u)
|
tpl.ExecuteTemplate(w, "signup.html", u)
|
||||||
@ -240,7 +241,7 @@ func main() {
|
|||||||
m.Get("/index1", index1)
|
m.Get("/index1", index1)
|
||||||
m.Post("/index1", index1)
|
m.Post("/index1", index1)
|
||||||
m.Get("/write", write)
|
m.Get("/write", write)
|
||||||
m.Get("/", index)
|
m.Get("/", login)
|
||||||
m.Get("/login", login)
|
m.Get("/login", login)
|
||||||
m.Post("/login", login)
|
m.Post("/login", login)
|
||||||
m.Get("/signup", signup)
|
m.Get("/signup", signup)
|
||||||
|
@ -3,18 +3,102 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
body{
|
||||||
|
background-color: rgb(197, 207, 224);
|
||||||
|
}
|
||||||
|
|
||||||
|
#panel {
|
||||||
|
width: 400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 15px 0 0;
|
||||||
|
background: rgb(169, 176, 187);
|
||||||
|
border: 1px solid silver;
|
||||||
|
font: 16px calibri;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
-webkit-box-shadow: 0 0 2px silver;
|
||||||
|
-moz-box-shadow: 0 0 2px silver;
|
||||||
|
box-shadow: 0 0 2px silver;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
display: block;
|
||||||
|
width: 260px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
color: #696969;
|
||||||
|
font-size: 16px;
|
||||||
|
text-shadow: 0 0 1px silver;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
#username, #password {
|
||||||
|
display: block;
|
||||||
|
width: 360px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 10px 5px;
|
||||||
|
border: 1px solid silver;
|
||||||
|
outline: 5px solid #ebebeb;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
#username:focus, #password:focus {
|
||||||
|
outline: 5px solid #e5f2f8;
|
||||||
|
}
|
||||||
|
input[type="submit"] {
|
||||||
|
width: 70px;
|
||||||
|
padding: 5px 13px;
|
||||||
|
border: 1px solid #005f85;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 0 0 1px black;
|
||||||
|
background: #98c9dc;
|
||||||
|
position: static;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#panel, input[type="submit"] {
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.sig {
|
||||||
|
display: block;
|
||||||
|
width: 260px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
color: #696969;
|
||||||
|
font-size: 32px;
|
||||||
|
text-shadow: 0 0 1px silver;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:link { color: #696; text-decoration: none; background-color: transparent }
|
||||||
|
a:visited { color: rgb(29, 29, 39); text-decoration: none; background-color: transparent }
|
||||||
|
a:hover { color: rgb(70, 110, 155); text-decoration: none; background-color: transparent }
|
||||||
|
a:active { color: #900; text-decoration: underline; background-color: transparent }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div id="panel">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|
||||||
|
|
||||||
<input type="email" name="username" placeholder="email"><br>
|
<input type="email" name="username" placeholder="email"><br>
|
||||||
<input type="password" name="password" placeholder="password"><br>
|
<input type="password" name="password" placeholder="hasło"><br>
|
||||||
<input type="text" name="firstname" placeholder="first name"><br>
|
<input type="text" name="firstname" placeholder="Imię"><br>
|
||||||
<input type="text" name="lastname" placeholder="last name"><br>
|
<input type="text" name="lastname" placeholder="Nazwisko"><br>
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user