mirror of
https://github.com/zyphlar/LanternPowerMonitor.git
synced 2024-03-08 14:07:47 +00:00
Update the open source PCB to have better ground connections.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.api-client</groupId>
|
||||
<artifactId>google-api-client-bom</artifactId>
|
||||
<version>1.33.2</version>
|
||||
<version>1.33.4</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -14,26 +14,27 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Locale;
|
||||
|
||||
@WebServlet("/signup")
|
||||
@WebServlet("/signup/*")
|
||||
public class SignupServlet extends LanternServlet {
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest _req, HttpServletResponse _rep) {
|
||||
boolean binary = isPath(_req, 0, "bin");
|
||||
BasicAuth auth = new BasicAuth(_req);
|
||||
Account acct = Globals.dao.getAccountByUsername(auth.getUsername().toLowerCase().trim());
|
||||
if (acct != null) {
|
||||
jsonResponse(_rep, SignupResponse.error("An account for " + auth.getUsername() + " already exists"));
|
||||
jsonResponse(_rep, SignupResponse.error("An account for " + auth.getUsername() + " already exists"), binary);
|
||||
return;
|
||||
}
|
||||
if (!EmailValidator.getInstance().isValid(auth.getUsername())) {
|
||||
jsonResponse(_rep, SignupResponse.error(auth.getUsername() + " is not a valid email address"));
|
||||
jsonResponse(_rep, SignupResponse.error(auth.getUsername() + " is not a valid email address"), binary);
|
||||
return;
|
||||
}
|
||||
if (NullUtils.length(auth.getPassword()) < 8) {
|
||||
jsonResponse(_rep, SignupResponse.error("Your password must be at least 8 characters long"));
|
||||
jsonResponse(_rep, SignupResponse.error("Your password must be at least 8 characters long"), binary);
|
||||
return;
|
||||
}
|
||||
if (NullUtils.isEqual("password", auth.getPassword())) {
|
||||
jsonResponse(_rep, SignupResponse.error("Seriously? \"password\"? Come on."));
|
||||
jsonResponse(_rep, SignupResponse.error("Seriously? \"password\"? Come on."), binary);
|
||||
return;
|
||||
}
|
||||
acct = new Account();
|
||||
@@ -42,6 +43,6 @@ public class SignupServlet extends LanternServlet {
|
||||
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, acct.getTimezone()));
|
||||
jsonResponse(_rep, SignupResponse.success(authCode, acct.getTimezone()), binary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GoogleAuthHelper {
|
||||
|
||||
public static String signin(String _code, TimeZone _tz) {
|
||||
try {
|
||||
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(transport, new GsonFactory(), "https://oauth2.googleapis.com/token", googleClientId, googleClientSecret, _code, "postmessage").execute();
|
||||
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(transport, new GsonFactory(), "https://oauth2.googleapis.com/token", googleClientId, googleClientSecret, _code, "https://lanternsoftware.com/console").execute();
|
||||
if (tokenResponse != null) {
|
||||
GoogleIdToken idToken = tokenResponse.parseIdToken();
|
||||
if (idToken != null)
|
||||
|
||||
Reference in New Issue
Block a user