Skip to content

Commit

Permalink
Squash username to lowercase at login (#2065)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernard Zhao <bernard.zhao.us@gmail.com>
  • Loading branch information
BernardZhao authored Dec 3, 2021
1 parent 83b9cb4 commit 388d7a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clientapi/auth/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package auth
import (
"context"
"net/http"
"strings"

"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/userutil"
Expand Down Expand Up @@ -48,7 +49,8 @@ func (t *LoginTypePassword) Request() interface{} {

func (t *LoginTypePassword) Login(ctx context.Context, req interface{}) (*Login, *util.JSONResponse) {
r := req.(*PasswordRequest)
username := r.Username()
// Squash username to all lowercase letters
username := strings.ToLower(r.Username())
if username == "" {
return nil, &util.JSONResponse{
Code: http.StatusUnauthorized,
Expand Down

0 comments on commit 388d7a1

Please sign in to comment.