Merge pull request #142 from bakape/fix-getid-args
Fix captcha.GetID() args
Cette révision appartient à :
révision
4814fff3dc
1 fichiers modifiés avec 4 ajouts et 4 suppressions
|
@ -18,7 +18,7 @@ import (
|
||||||
func UserRegisterFormHandler(w http.ResponseWriter, r *http.Request) {
|
func UserRegisterFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
b := form.RegistrationForm{}
|
b := form.RegistrationForm{}
|
||||||
modelHelper.BindValueForm(&b, r)
|
modelHelper.BindValueForm(&b, r)
|
||||||
b.CaptchaID = captcha.GetID(r.RemoteAddr)
|
b.CaptchaID = captcha.GetID()
|
||||||
languages.SetTranslation("en-us", viewRegisterTemplate)
|
languages.SetTranslation("en-us", viewRegisterTemplate)
|
||||||
htv := UserRegisterTemplateVariables{b, NewSearchForm(), Navigation{}, r.URL, mux.CurrentRoute(r)}
|
htv := UserRegisterTemplateVariables{b, NewSearchForm(), Navigation{}, r.URL, mux.CurrentRoute(r)}
|
||||||
err := viewRegisterTemplate.ExecuteTemplate(w, "index.html", htv)
|
err := viewRegisterTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
|
@ -53,9 +53,9 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// Check same Password
|
// Check same Password
|
||||||
if !captcha.Authenticate(captcha.Extract(r)) {
|
if !captcha.Authenticate(captcha.Extract(r)) {
|
||||||
// TODO: Prettier passing of mistyoed captcha errors
|
// TODO: Prettier passing of mistyoed captcha errors
|
||||||
http.Error(w, captcha.ErrInvalidCaptcha.Error(), 403)
|
http.Error(w, captcha.ErrInvalidCaptcha.Error(), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (r.PostFormValue("password") == r.PostFormValue("password_confirm")) && (r.PostFormValue("password") != "") {
|
if (r.PostFormValue("password") == r.PostFormValue("password_confirm")) && (r.PostFormValue("password") != "") {
|
||||||
if (form.EmailValidation(r.PostFormValue("email"))) && (form.ValidateUsername(r.PostFormValue("username"))) {
|
if (form.EmailValidation(r.PostFormValue("email"))) && (form.ValidateUsername(r.PostFormValue("username"))) {
|
||||||
|
|
Référencer dans un nouveau ticket