Skip to content

Commit b6189df

Browse files
2 parents 1aa8d58 + e33d8ed commit b6189df

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

server/src/jhi/fab/UserSessionsResource.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,13 @@ public synchronized Response postUser(@HeaderParam("Authorization") String authH
208208
{
209209
DSLContext context = DSL.using(conn, SQLDialect.MYSQL);
210210

211+
String email = userInfo.getEmail();
212+
if (email != null)
213+
email = email.toLowerCase();
214+
211215
Users dbUser = context.insertInto(USERS)
212216
.set(USERS.USER_NAME, userInfo.getUserName())
213-
.set(USERS.EMAIL, userInfo.getEmail().toLowerCase())
217+
.set(USERS.EMAIL, email)
214218
.set(USERS.IS_ADMIN, userInfo.getIsAdmin())
215219
.returning(USERS.fields())
216220
.fetchOneInto(Users.class);
@@ -240,9 +244,13 @@ public synchronized Response patchUser(@HeaderParam("Authorization") String auth
240244
{
241245
DSLContext context = DSL.using(conn, SQLDialect.MYSQL);
242246

247+
String email = userInfo.getEmail();
248+
if (email != null)
249+
email = email.toLowerCase();
250+
243251
context.update(USERS)
244252
.set(USERS.USER_NAME, userInfo.getUserName())
245-
.set(USERS.EMAIL, userInfo.getEmail().toLowerCase())
253+
.set(USERS.EMAIL, email)
246254
.set(USERS.IS_ADMIN, userInfo.getIsAdmin())
247255
.where(USERS.USER_ID.eq(userInfo.getUserId()))
248256
.execute();

0 commit comments

Comments
 (0)