From d55a93e653ff5d8810d539724c3d5a9ad96b8453 Mon Sep 17 00:00:00 2001 From: jan <jan@ruken.pw> Date: Sun, 20 Dec 2015 17:32:36 +0100 Subject: registration 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 func (r *Renderer) RenderLoginPage(w http.ResponseWriter, data map[string]interface{}) { r.RenderPage("login", w, data) } + +// RenderRegistrationPage zeigt die Registrationsseite an. +func (r *Renderer) RenderRegistrationPage(w http.ResponseWriter, data map[string]interface{}) { + r.RenderPage("register", w, data) +} diff --git a/main.go b/main.go index c3d8ef6..f367922 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,8 @@ func main() { router.HandlerFunc("GET", "/login", charakterin.DisplayLogin) router.HandlerFunc("POST", "/login", charakterin.Login) router.HandlerFunc("GET", "/logout", charakterin.Logout) + router.HandlerFunc("GET", "/register", charakterin.DisplayRegistration) + router.HandlerFunc("POST", "/register", charakterin.Register) router.GET("/", index) 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 @@ </head> <body> <div class="row"> - <div class="col s12 m6 offset-m3 l6 offset-l3"> + <div class="col s12 m6 offset-m3 l4 offset-l4"> <div class="row"> <h1 class="center-align">grilist</h1> {{ if .error }} @@ -32,7 +32,7 @@ </div> <div class="row col s12"> <div class="col s4"> - <a class="waves-effect waves-teal btn-flat">Register</a> + <a class="waves-effect waves-teal btn-flat" href="/register">Register</a> </div> <div class="right-align"> <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 @@ +{{ define "register" }} +<html> + <head> + <title>Grilist - Registration</title> + {{ template "materialize" }} + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> + </head> + <body> + <div class="row"> + <div class="col s12 m6 offset-m3 l4 offset-l4"> + <div class="row"> + <h1 class="center-align">grilist</h1> + {{ if .error }} + <div class="col s12 m8 offset-m2"> + <div class="card red lighten-2"> + <div class="card-content white-text"> + <span class="card-title">Fehler</span> + <p>Es gab einen Fehler: {{ .error }}</p> + </div> + </div> + </div> + {{ end }} + + <form method="POST" name="registration" action="#"> + <div class="input-field col s12"> + <i class="material-icons prefix">perm_identity</i> + <input name="username" type="text" placeholder="Username" class="validate" value="{{ .previous_user }}"/> + </div> + <div class="input-field col s12"> + <i class="material-icons prefix">lock_outline</i> + <input name="password" type="password" placeholder="Password" class="validate" /> + </div> + <div class="input-field col s12"> + <i class="material-icons prefix">email</i> + <input name="email" type="email" placeholder="E-Mail" class="validate"> + </div> + <div class="row col s12"> + <div class="col s4"> + <a class="waves-effect waves-teal btn-flat" href="/">Cancel</a> + </div> + <div class="right-align"> + <button class="btn waves-effect waves-light purple lighten-2" type="submit" name="action"> + Register <i class="material-icons right">send</i> + </button> + </div> + </div> + </form> + </div> + </div> + </div> + </body> +</html> +{{ end }} \ No newline at end of file -- cgit v0.10.1