some form changes
alex wennerberg alex@alexwennerberg.com
Sun, 06 Dec 2020 02:22:45 -0800
3 files changed,
20 insertions(+),
6 deletions(-)
M
http.go
→
http.go
@@ -204,7 +204,6 @@ }
http.Redirect(w, r, "/my_site", http.StatusSeeOther) } -// TODO use this type AuthUser struct { LoggedIn bool Username string@@ -559,6 +558,16 @@ }
} func resetPasswordHandler(w http.ResponseWriter, r *http.Request) { + user := newGetAuthUser(r) + data := struct { + PageTitle string + AuthUser AuthUser + Error error + }{"Reset Password", user, nil} + err := t.ExecuteTemplate(w, "reset_pass.html", data) + if err != nil { + panic(err) + } } func adminUserHandler(w http.ResponseWriter, r *http.Request) {
M
templates/me.html
→
templates/me.html
@@ -4,6 +4,7 @@ {{template "nav.html" .}}
<form action="/me" method="post"> <div> <label for="username">Username</label><br> + <em>Note: renaming your account will cause links to your pages to break</em> <input id="username" name="username"@@ -29,13 +30,17 @@ </div>
</form> <a href="/reset-password">Reset password</a> <p><a href="/my_site/flounder-archive.zip">🗄️ Download my site archive (.zip)</a></p> -<form action="/delete-account" method="POST" class="inline"> +<details> + <summary>Delete Account</summary> + <form action="/delete-account" method="POST"> +<label for="validate-delete">Type in your username to delete your account:</label> +<input id="validate-delete" name="validate-delete" size="32" type="text" value="" /> <input class="button delete" type="submit" - onclick="return confirm('Are you SURE you want to delete your account and all your files?');" value="Delete account" + onclick="return confirm('Are you SURE you want to delete your account and all your files?');" /> - +</details> {{template "footer" .}} </form>
M
templates/reset_pass.html
→
templates/reset_pass.html
@@ -1,6 +1,6 @@
{{template "header" .}} <h1>Reset Password</h1> -<form action="/reset_password" method="post"> +<form action="/reset-password" method="post"> <div> <label for="password">Current Password</label><br> <input@@ -8,7 +8,7 @@ id="password"
name="password" size="32" type="text" - value="{{.AuthUser}}" + value="" /> </div> <div>