aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2015-12-20 16:32:36 (UTC)
committerjan <jan@ruken.pw>2015-12-20 16:32:36 (UTC)
commitd55a93e653ff5d8810d539724c3d5a9ad96b8453 (patch)
tree74c06bffbf0f6bb32919a3bb4e83c7d481fe6fee
parent9c96dd6a8bef0d70023d4eaee748916088707765 (diff)
registration
-rw-r--r--frontend/renderer.go5
-rw-r--r--main.go2
-rw-r--r--views/login.html4
-rw-r--r--views/register.html53
4 files changed, 62 insertions, 2 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go
index 5673860..f03fe77 100644
--- a/frontend/renderer.go
+++ b/frontend/renderer.go
@@ -31,3 +31,8 @@ func (r *Renderer) RenderPage(name string, w http.ResponseWriter, data map[strin
31func (r *Renderer) RenderLoginPage(w http.ResponseWriter, data map[string]interface{}) { 31func (r *Renderer) RenderLoginPage(w http.ResponseWriter, data map[string]interface{}) {
32 r.RenderPage("login", w, data) 32 r.RenderPage("login", w, data)
33} 33}
34
35// RenderRegistrationPage zeigt die Registrationsseite an.
36func (r *Renderer) RenderRegistrationPage(w http.ResponseWriter, data map[string]interface{}) {
37 r.RenderPage("register", w, data)
38}
diff --git a/main.go b/main.go
index c3d8ef6..f367922 100644
--- a/main.go
+++ b/main.go
@@ -48,6 +48,8 @@ func main() {
48 router.HandlerFunc("GET", "/login", charakterin.DisplayLogin) 48 router.HandlerFunc("GET", "/login", charakterin.DisplayLogin)
49 router.HandlerFunc("POST", "/login", charakterin.Login) 49 router.HandlerFunc("POST", "/login", charakterin.Login)
50 router.HandlerFunc("GET", "/logout", charakterin.Logout) 50 router.HandlerFunc("GET", "/logout", charakterin.Logout)
51 router.HandlerFunc("GET", "/register", charakterin.DisplayRegistration)
52 router.HandlerFunc("POST", "/register", charakterin.Register)
51 router.GET("/", index) 53 router.GET("/", index)
52 54
53 fs := http.FileServer(http.Dir("assets")) 55 fs := http.FileServer(http.Dir("assets"))
diff --git a/views/login.html b/views/login.html
index 33627cb..d671d50 100644
--- a/views/login.html
+++ b/views/login.html
@@ -7,7 +7,7 @@
7 </head> 7 </head>
8 <body> 8 <body>
9 <div class="row"> 9 <div class="row">
10 <div class="col s12 m6 offset-m3 l6 offset-l3"> 10 <div class="col s12 m6 offset-m3 l4 offset-l4">
11 <div class="row"> 11 <div class="row">
12 <h1 class="center-align">grilist</h1> 12 <h1 class="center-align">grilist</h1>
13 {{ if .error }} 13 {{ if .error }}
@@ -32,7 +32,7 @@
32 </div> 32 </div>
33 <div class="row col s12"> 33 <div class="row col s12">
34 <div class="col s4"> 34 <div class="col s4">
35 <a class="waves-effect waves-teal btn-flat">Register</a> 35 <a class="waves-effect waves-teal btn-flat" href="/register">Register</a>
36 </div> 36 </div>
37 <div class="right-align"> 37 <div class="right-align">
38 <button class="btn waves-effect waves-light purple lighten-2" type="submit" name="action"> 38 <button class="btn waves-effect waves-light purple lighten-2" type="submit" name="action">
diff --git a/views/register.html b/views/register.html
new file mode 100644
index 0000000..3c78f46
--- /dev/null
+++ b/views/register.html
@@ -0,0 +1,53 @@
1{{ define "register" }}
2<html>
3 <head>
4 <title>Grilist - Registration</title>
5 {{ template "materialize" }}
6 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
7 </head>
8 <body>
9 <div class="row">
10 <div class="col s12 m6 offset-m3 l4 offset-l4">
11 <div class="row">
12 <h1 class="center-align">grilist</h1>
13 {{ if .error }}
14 <div class="col s12 m8 offset-m2">
15 <div class="card red lighten-2">
16 <div class="card-content white-text">
17 <span class="card-title">Fehler</span>
18 <p>Es gab einen Fehler: {{ .error }}</p>
19 </div>
20 </div>
21 </div>
22 {{ end }}
23
24 <form method="POST" name="registration" action="#">
25 <div class="input-field col s12">
26 <i class="material-icons prefix">perm_identity</i>
27 <input name="username" type="text" placeholder="Username" class="validate" value="{{ .previous_user }}"/>
28 </div>
29 <div class="input-field col s12">
30 <i class="material-icons prefix">lock_outline</i>
31 <input name="password" type="password" placeholder="Password" class="validate" />
32 </div>
33 <div class="input-field col s12">
34 <i class="material-icons prefix">email</i>
35 <input name="email" type="email" placeholder="E-Mail" class="validate">
36 </div>
37 <div class="row col s12">
38 <div class="col s4">
39 <a class="waves-effect waves-teal btn-flat" href="/">Cancel</a>
40 </div>
41 <div class="right-align">
42 <button class="btn waves-effect waves-light purple lighten-2" type="submit" name="action">
43 Register <i class="material-icons right">send</i>
44 </button>
45 </div>
46 </div>
47 </form>
48 </div>
49 </div>
50 </div>
51 </body>
52</html>
53{{ end }} \ No newline at end of file