Forgot that I still had everything hard-coded to central time. Changed it to be configurable per account.

This commit is contained in:
Mark Milligan
2021-01-16 21:15:07 -06:00
parent 98d1f0168c
commit 3d7f116baa
10 changed files with 103 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.lanternsoftware.currentmonitor.context.Globals;
import com.lanternsoftware.util.DateUtils;
import com.lanternsoftware.util.LanternFiles;
import com.lanternsoftware.util.NullUtils;
import com.lanternsoftware.util.ResourceLoader;
@@ -38,7 +39,7 @@ public class AuthServlet extends CMServlet {
if (idToken != null) {
GoogleIdToken.Payload payload = idToken.getPayload();
String email = payload.getEmail();
authCode = Globals.dao.getAuthCodeForEmail(email);
authCode = Globals.dao.getAuthCodeForEmail(email, DateUtils.fromTimeZoneId(_req.getHeader("timezone")));
}
}
catch (Exception _e) {

View File

@@ -3,9 +3,8 @@ package com.lanternsoftware.currentmonitor.servlet;
import com.lanternsoftware.currentmonitor.context.Globals;
import com.lanternsoftware.datamodel.currentmonitor.Account;
import com.lanternsoftware.datamodel.currentmonitor.SignupResponse;
import com.lanternsoftware.util.DateUtils;
import com.lanternsoftware.util.NullUtils;
import com.lanternsoftware.util.dao.DaoEntity;
import com.lanternsoftware.util.dao.DaoSerializer;
import com.lanternsoftware.util.email.EmailValidator;
import com.lanternsoftware.util.servlet.BasicAuth;
@@ -38,6 +37,7 @@ public class SignupServlet extends CMServlet {
acct = new Account();
acct.setUsername(auth.getUsername());
acct.setPassword(auth.getPassword());
acct.setTimezone(DateUtils.fromTimeZoneId(_req.getHeader("timezone")).getID());
Globals.dao.putAccount(acct);
String authCode = Globals.dao.authenticateAccount(auth.getUsername(), auth.getPassword());
jsonResponse(_rep, SignupResponse.success(authCode));