Add optional e-mail field to sign up form.
このコミットが含まれているのは:
コミット
308d3e796c
7
main.go
7
main.go
|
@ -72,6 +72,7 @@ func signUpHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
name := r.FormValue("name")
|
name := r.FormValue("name")
|
||||||
pw := r.FormValue("password")
|
pw := r.FormValue("password")
|
||||||
pw2 := r.FormValue("password2")
|
pw2 := r.FormValue("password2")
|
||||||
|
mail := r.FormValue("mail")
|
||||||
if 0 != strings.Compare(pw, pw2) || 0 == strings.Compare("name", "") ||
|
if 0 != strings.Compare(pw, pw2) || 0 == strings.Compare("name", "") ||
|
||||||
0 == strings.Compare(pw, "") || !onlyLegalRunes(name) ||
|
0 == strings.Compare(pw, "") || !onlyLegalRunes(name) ||
|
||||||
len(name) > 140 {
|
len(name) > 140 {
|
||||||
|
@ -99,7 +100,7 @@ func signUpHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Can't generate password hash", err)
|
log.Fatal("Can't generate password hash", err)
|
||||||
}
|
}
|
||||||
new_line := name + " " + string(hash) + "\n"
|
new_line := name + " " + string(hash) + " " + mail + "\n"
|
||||||
appendToFile(loginsFile, new_line)
|
appendToFile(loginsFile, new_line)
|
||||||
execTemplate(w, "signup.html", "")
|
execTemplate(w, "signup.html", "")
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,7 @@ func listHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
tokens := strings.Split(line, " ")
|
tokens := strings.Split(line, " ")
|
||||||
if len(tokens) == 2 {
|
if len(tokens) == 3 {
|
||||||
dir = append(dir, tokens[0])
|
dir = append(dir, tokens[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +146,7 @@ func twtxtPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
tokens := strings.Split(line, " ")
|
tokens := strings.Split(line, " ")
|
||||||
if len(tokens) == 2 {
|
if len(tokens) == 3 {
|
||||||
if 0 == strings.Compare(tokens[0], name) &&
|
if 0 == strings.Compare(tokens[0], name) &&
|
||||||
nil == bcrypt.CompareHashAndPassword(
|
nil == bcrypt.CompareHashAndPassword(
|
||||||
[]byte(tokens[1]), []byte(pw)) {
|
[]byte(tokens[1]), []byte(pw)) {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
Name: <input type="text" name="name" /> (only up to 140 legal chars: A-Z, a-z, 0-1, _)<br />
|
Name: <input type="text" name="name" /> (only up to 140 legal chars: A-Z, a-z, 0-1, _)<br />
|
||||||
Password: <input type="password" name="password" /><br />
|
Password: <input type="password" name="password" /><br />
|
||||||
Password (repeat): <input type="password" name="password2" /><br />
|
Password (repeat): <input type="password" name="password2" /><br />
|
||||||
|
E-Mail: <input type="text" name="mail" /> (optional; stored internally to reach and/or identify you when there's trouble with your feed, you want to reset your password, etc.; in any such communication, communicating from an address provided here is a necessary condition for you to be treated as the owner of your feed)<br />
|
||||||
<input type="submit" value="create" />
|
<input type="submit" value="create" />
|
||||||
</form>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
読み込み中…
新しいイシューから参照