Permalink
Browse files

step one of AccountChooser integration: adding storeAccount api call and

a page to invoke the js.
  • Loading branch information...
primmer
primmer committed Sep 17, 2012
1 parent 0b8b153 commit be1609abec6ea92731b5759ed1dc0ebf0f7f3925
@@ -60,13 +60,14 @@ private void loginRegisteredUser(HttpSession session,
Entity user, HttpServletResponse resp) throws IOException {
if (user != null) {
setUserSession(user, session);
// At the end of a login, always attempt to store the account in
// accountchooser.
resp.sendRedirect("/accountchooser-store.jsp");
} else {
// The user wasn't registered and we don't have fancy form error
// handling.
// handling. Don't store, try to create an account.
resp.sendRedirect("/account-create.jsp");
}
// At the end of a login, go to the homepage.
resp.sendRedirect("/guestbook.jsp");
}
private Entity getUser(DatastoreService datastore, String user_id) {
@@ -0,0 +1 @@
/appengine-generated
@@ -0,0 +1,40 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

This comment has been minimized.

Show comment
Hide comment
@Jodyhope
@Jodyhope
<%@ page import="guestbook.UserServlet" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%
// The page is loaded at the end of a sign-in or account creation.
// It loads the "save" feature of Account Chooser. The browser is
// redirected to accountchooser.com and has the option to store the
// currently signed in account. If the account is currently stored,
// the ac.js redirects to the homeurl location.
String user_id = (String) session.getAttribute("user_id");
String name = (String) session.getAttribute("name");
String photo = (String) session.getAttribute("photo");
// Don't bother trying to store the account if there's no user_id.
if (user_id == null || user_id.isEmpty()) {
response.sendRedirect("/guestbook.jsp");
}
%>
<html>
<head>
<!-- Begin AC integration -->
<script type="text/javascript" src="https://www.accountchooser.com/ac.js">
storeAccount: {
// After the storeAccount method, redirect to homeUrl"
homeUrl: '/guestbook.jsp',
email: '<%= user_id %>',
displayName: '<%= name %>',
photoUrl: '<%= photo %>'
}
</script>
<!-- End AC integration -->
</head>
<body>
</body>
</html>

1 comment on commit be1609a

@Fazlerabbi71270

This comment has been minimized.

Show comment
Hide comment
@Fazlerabbi71270

Fazlerabbi71270 Aug 21, 2016

requesting for pull request

Fazlerabbi71270 commented on be1609a Aug 21, 2016

requesting for pull request

Please sign in to comment.