@@ -85,18 +85,18 @@ func (p *UserProvider) UserByEmail(ctx context.Context, email string) (*kubermat
8585// CreateUser creates a new user. If no user is found at all the created user is elected as the first admin.
8686//
8787// Note that:
88- // The name of the newly created resource will be unique and it is derived from the user's email address (sha256(email)
88+ // The name of the newly created resource will be unique and it is derived from the user's email address (sha256(email))
8989// This prevents creating multiple resources for the same user with the same email address.
9090//
91- // In the beginning I was considering to hex-encode the email address as it will produce a unique output because the email address in unique.
91+ // In the beginning I was considering to hex-encode the email address as it will produce a unique output because the email address is unique.
9292// The only issue I have found with this approach is that the length can get quite long quite fast.
9393// Thus decided to use sha256 as it produces fixed output and the hash collisions are very, very, very, very rare.
9494
9595func (p * UserProvider ) CreateUser (ctx context.Context , name , email string , groups []string ) (* kubermaticv1.User , error ) {
9696 if len (name ) == 0 || len (email ) == 0 {
9797 return nil , apierrors .NewBadRequest ("Email, ID and Name cannot be empty when creating a new user resource" )
9898 }
99-
99+ email = strings . ToLower ( email )
100100 if kubermaticv1helper .IsProjectServiceAccount (email ) {
101101 return nil , apierrors .NewBadRequest (fmt .Sprintf ("cannot add a user with the given email %s as the name is reserved, please try a different email address" , email ))
102102 }
@@ -132,7 +132,7 @@ func (p *UserProvider) CreateUser(ctx context.Context, name, email string, group
132132func (p * UserProvider ) UpdateUser (ctx context.Context , user * kubermaticv1.User ) (* kubermaticv1.User , error ) {
133133 // make sure the first patch doesn't override the status
134134 status := user .Status .DeepCopy ()
135-
135+ user . Spec . Email = strings . ToLower ( user . Spec . Email )
136136 if err := p .runtimeClient .Update (ctx , user ); err != nil {
137137 return nil , err
138138 }
0 commit comments