[MM-22037] Enable uppercase letters in the email (#13794)

* Enable uppercase letters in the email

* Lowercase email on every input

* Remove invalid test
Этот коммит содержится в:
Shota Gvinepadze
2020-02-12 17:51:45 +04:00
коммит произвёл GitHub
родитель 28ef877876
Коммит a7854f1b97
10 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@@ -10,6 +10,7 @@ import (
"io/ioutil"
"net/http"
"strconv"
"strings"
"time"
"github.com/mattermost/mattermost-server/v5/app"
@@ -244,7 +245,7 @@ func getUserByUsername(c *Context, w http.ResponseWriter, r *http.Request) {
}
func getUserByEmail(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireEmail()
c.SanitizeEmail()
if c.Err != nil {
return
}
@@ -1264,6 +1265,7 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
email := props["email"]
email = strings.ToLower(email)
if len(email) == 0 {
c.SetInvalidParam("email")
return
@@ -1625,6 +1627,7 @@ func sendVerificationEmail(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
email := props["email"]
email = strings.ToLower(email)
if len(email) == 0 {
c.SetInvalidParam("email")
return