Skip to content
Snippets Groups Projects
Commit e243302c authored by Shrey Patel's avatar Shrey Patel
Browse files

fixed bug with auth/login

parent fe3d7499
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ public class AuthController { ...@@ -46,7 +46,7 @@ public class AuthController {
{ {
res.put("user", user.get().getEmail()); res.put("user", user.get().getEmail());
//give them a token //give them a token
res.put("jwt", JWT.createJWT("id", "issuer", "sarthaks@vt.edu", 99999999)); res.put("jwt", JWT.createJWT("id", "issuer", json.get("email"), 99999999));
res.put("result", "success"); res.put("result", "success");
return res; return res;
} }
...@@ -66,9 +66,12 @@ public class AuthController { ...@@ -66,9 +66,12 @@ public class AuthController {
Claims claim = JWT.decodeJWT(json.get("jwt")); Claims claim = JWT.decodeJWT(json.get("jwt"));
if (claim != null) if (claim != null)
{ {
}
res.put("user", claim.getSubject()); res.put("user", claim.getSubject());
}
else
{
res.put("login", "failed - expired/bad token");
}
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment