Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Adding google sign in for login functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
david.anderson committed Sep 14, 2015
1 parent 8aab62d commit b0c868a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public String getMoneyTrackerLanding(HttpSession session, Model model) {

@RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
public String getMoneyTrackerDetail(@PathVariable String uuid, Model model, HttpSession httpSession) {
System.out.println("UUID = " + uuid);
model.addAttribute("tracker", ((User) httpSession.getAttribute("loggedInUser")).getMoneyTrackerByUUID(UUID.fromString(uuid)));

return "/WEB-INF/jsp/money-tracker/detail.jsp";
Expand Down
43 changes: 39 additions & 4 deletions money-tracker-online/src/main/webapp/WEB-INF/jsp/auth/login.jsp
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Enroll</title>
<title>Money Tracker | Login</title>

<meta name="google-signin-scope" content="email">
<meta name="google-signin-client_id" content="579578888422-s2am38top0sk6ouqb4dc5lncsfn2onv7.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>

<%@include file="../common/style-includes.jsp" %>

</head>
<body>

<form method="POST">
<input type="text" name="emailAddress"/>
<button type="submit" value="Enroll">Enroll</button>
<div class="pageWrapper">
<jsp:include page="../common/nav-bar.jsp"/>

<div class="pageBody">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="panel">
<div class="panel-heading">
<h3 class="text-center">Login to start Trackin yo' Monies</h3>
</div>
<div class="panel-body">
<div class="g-signin2" data-width="328" data-height="65" data-longtitle="true" data-onsuccess="onSignIn" data-theme="dark"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
document.getElementById('loginVal').value = profile.getEmail();
document.getElementById('frmLogin').submit();
};
</script>

<form method="POST" id="frmLogin">
<input id="loginVal" type="hidden" name="emailAddress"/>
</form>

</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="pageHeading">
<div class="container">
<div class="navbar-right">
<ul>
<li><a href="<c:url value="/money-tracker"/>">Money Trackers</a></li>
</ul>
<div style="
margin: 0 auto;
width: 25%;
font-size: 2em;
min-width:211px;
text-align:center;
">
<a href="<c:url value="/money-tracker"/>">Track yo' Monies</a>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@


<div class="row">
<div class="col-md-offset-8 col-md-2 push-top-hard">
<div class="col-md-2 push-top-hard">
<a class="btn btn-default" href="<c:url value='/money-tracker/create'/>">New Tracker</a>
</div>
</div>
Expand Down

0 comments on commit b0c868a

Please sign in to comment.