diff options
-rw-r--r-- | frontend/renderer.go | 5 | ||||
-rw-r--r-- | main.go | 1 | ||||
-rw-r--r-- | views/user_settings.html | 62 |
3 files changed, 68 insertions, 0 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go index f311462..eeff58e 100644 --- a/frontend/renderer.go +++ b/frontend/renderer.go | |||
@@ -101,3 +101,8 @@ func (r *Renderer) RenderLoginPage(w http.ResponseWriter, data map[string]interf | |||
101 | func (r *Renderer) RenderRegistrationPage(w http.ResponseWriter, data map[string]interface{}) { | 101 | func (r *Renderer) RenderRegistrationPage(w http.ResponseWriter, data map[string]interface{}) { |
102 | r.RenderPage("register", w, data) | 102 | r.RenderPage("register", w, data) |
103 | } | 103 | } |
104 | |||
105 | // RenderUserSettingsPage zeigt die Einstellungen für den Benutzer an. | ||
106 | func (r *Renderer) RenderUserSettingsPage(w http.ResponseWriter, data map[string]interface{}) { | ||
107 | r.RenderPage("user_settings", w, data) | ||
108 | } | ||
@@ -63,6 +63,7 @@ func main() { | |||
63 | 63 | ||
64 | router.HandlerFunc("GET", "/login", login.DisplayLogin) | 64 | router.HandlerFunc("GET", "/login", login.DisplayLogin) |
65 | router.HandlerFunc("POST", "/login", login.Login) | 65 | router.HandlerFunc("POST", "/login", login.Login) |
66 | router.HandlerFunc("GET", "/settings", login.DisplayUserSettings) | ||
66 | router.HandlerFunc("GET", "/logout", login.Logout) | 67 | router.HandlerFunc("GET", "/logout", login.Logout) |
67 | router.HandlerFunc("GET", "/register", login.DisplayRegistration) | 68 | router.HandlerFunc("GET", "/register", login.DisplayRegistration) |
68 | router.HandlerFunc("POST", "/register", login.Register) | 69 | router.HandlerFunc("POST", "/register", login.Register) |
diff --git a/views/user_settings.html b/views/user_settings.html new file mode 100644 index 0000000..cf350a5 --- /dev/null +++ b/views/user_settings.html | |||
@@ -0,0 +1,62 @@ | |||
1 | {{ define "user_settings" }} | ||
2 | <html> | ||
3 | <head> | ||
4 | {{ template "materialize" }} | ||
5 | <title>{{ .user.Name }} - grilist</title> | ||
6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | ||
7 | </head> | ||
8 | <body> | ||
9 | {{ template "navbar" . }} | ||
10 | <div class="container"> | ||
11 | <h1>{{ .user.Name }}</h1> | ||
12 | <div class="row"> | ||
13 | <div class="col s12 m6 offset-m3 l4 offset-l4"> | ||
14 | {{ if .error }} | ||
15 | <div class="col s12 m8 offset-m2"> | ||
16 | <div class="card red lighten-2"> | ||
17 | <div class="card-content white-text"> | ||
18 | <span class="card-title">Fehler</span> | ||
19 | <p>Es gab einen Fehler: {{ .error }}</p> | ||
20 | </div> | ||
21 | </div> | ||
22 | </div> | ||
23 | {{ end }} | ||
24 | <form method="POST" name="login" action="#"> | ||
25 | <div class="input-field col s12"> | ||
26 | <blockquote>Standardmäßig wird dein Benutzername angezeigt. Das Ändern des Anzeigenamen erlaubt dir, dass dich andere Nutzer unter einem anderen Namen sehen.</blockquote> | ||
27 | <i class="material-icons prefix">perm_identity</i> | ||
28 | <input name="username" type="text" placeholder="Anzeigename" class="validate" value="{{ if .user.DisplayName.Valid }}{{ .user.DisplayName.Value }}{{ end }}"/> | ||
29 | </div> | ||
30 | <br /><br /> | ||
31 | <h3>Passwort ändern</h3> | ||
32 | <blockquote>Dein Passwort muss eine Länge von mindestens benis Zeichen haben.</blockquote> | ||
33 | <div class="input-field col s12"> | ||
34 | <i class="material-icons prefix">lock_outline</i> | ||
35 | <input name="password_current" type="password" placeholder="Aktuelles Passwort" class="validate" /> | ||
36 | </div> | ||
37 | <div class="input-field col s12"> | ||
38 | <i class="material-icons prefix">lock</i> | ||
39 | <input name="password_new" type="password" placeholder="Neues Passwort" class="validate" /> | ||
40 | </div> | ||
41 | <div class="input-field col s12"> | ||
42 | <i class="material-icons prefix">lock</i> | ||
43 | <input name="password_new2" type="password" placeholder="Neues Passwort (wiederholen)" class="validate" /> | ||
44 | </div> | ||
45 | <div class="row col s12 right-align"> | ||
46 | <button class="btn waves-effect waves-light purple lighten-2" type="submit" name="action"> | ||
47 | Speichern <i class="material-icons right">send</i> | ||
48 | </button> | ||
49 | <br /><br /> | ||
50 | <hr /> | ||
51 | <br /> | ||
52 | </div> | ||
53 | <div class="row col s12"> | ||
54 | <a class="waves-effect waves-light red lighten-1 btn-large valign-wrapper" style="width: 100%; height: 80px; padding-top: 12px" href="#">Löscht mich!</a> | ||
55 | </div> | ||
56 | </form> | ||
57 | </div> | ||
58 | </div> | ||
59 | </div> | ||
60 | </body> | ||
61 | </html> | ||
62 | {{ end }} | ||