commenter_new.go: do not return error on empty website
Closes https://gitlab.com/commento/commento-ce/issues/57
This commit is contained in:
parent
eaa8001e7e
commit
99177a59c3
@ -1,9 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func commenterNew(email string, name string, link string, photo string, provider string, password string) (string, error) {
|
||||
@ -18,7 +19,7 @@ func commenterNew(email string, name string, link string, photo string, provider
|
||||
// See utils_sanitise.go's documentation on isHttpsUrl. This is not a URL
|
||||
// validator, just an XSS preventor.
|
||||
// TODO: reject URLs instead of malforming them.
|
||||
if !isHttpsUrl(link) {
|
||||
if link != "undefined" && !isHttpsUrl(link) {
|
||||
link = "https://" + link
|
||||
}
|
||||
|
||||
@ -71,6 +72,10 @@ func commenterNewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO: add gravatar?
|
||||
// TODO: email confirmation if provider = commento?
|
||||
// TODO: email confirmation if provider = commento?
|
||||
if *x.Website == "" {
|
||||
*x.Website = "undefined"
|
||||
}
|
||||
|
||||
if _, err := commenterNew(*x.Email, *x.Name, *x.Website, "undefined", "commento", *x.Password); err != nil {
|
||||
bodyMarshal(w, response{"success": false, "message": err.Error()})
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user