Commits

Anonymous committed 624bdc8

openid works well

  • Participants
  • Parent commits 1824642

Comments (0)

Files changed (7)

File src/info/mrchen/gae/blog/controller/UserProfileController.java

 
 	@RequestMapping("/profile/index.do")
 	public void show(Model model) {
-		model.addAttribute("username", userInfoService.getMyProfile(userService.getCurrentUser()));
+		model.addAttribute("MyProfile", userInfoService.getMyProfile(userService.getCurrentUser()));
 	}
 }

File src/info/mrchen/gae/blog/dao/UserInfoService.java

 import info.mrchen.gae.blog.pojo.UserInfo;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 import com.google.appengine.api.users.User;
 
+@Component
 public class UserInfoService {
 
 	@Autowired

File war/Navi.jsp

 	<tr>
 		<td><a href="/">Top</a></td>
 		<td><a href="/Article-List.do">文章</a></td>
-		<td><a href="/admin/">管理</a></td>
+		<td><a href="/profile/index.do">设定</a></td>
+		<td><a href="/Logout.jsp">Logout</a></td>
 	</tr>
 </table>

File war/WEB-INF/urlrewrite.xml

 		<to>/test/status/</to>
 	</outbound-rule>
 	<rule>
-		<from>_ah/login_required(.*)</from>
+		<from>/_ah/login_required(.*)</from>
 		<to>/login.jsp$1</to>
 	</rule>
 

File war/WEB-INF/views/profile/index.jsp

+<%@ page contentType="text/html;charset=UTF-8" language="java"%>
+<%@page isELIgnored="false"%>
+<%@ include file="/WEB-INF/views/common/includes.jsp"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<link rel="icon" href="/Images/favicon.ico">
+<title>mrchen-gae-blog</title>
+</head>
+
+<body>
+<jsp:include page="/Navi.jsp" />
+${MyProfile}
+</body>
+</html>

File war/image/OpenID_logo.png

Added
New image

File war/login.jsp

 <style type="text/css">
 input#openid_url {
 	text-indent: 18px;
-	background-image:
-		url("http://sample.openid-idp.com/img/openid_logo.png");
-	background-repeat: no-repeat;
+	background-image:url("/image/OpenID_logo.png");
+	background-repeat:no-repeat;
 	background-position: left center;
 }
 </style>
 <body>
 <%
 	String openid_url = request.getParameter("openid_url");
-	if (openid_url != null || openid_url.length() > 1) {
+	if (openid_url != null && openid_url.length() > 1) {
 		String return_url = request.getParameter("continue");
 		UserService userService = UserServiceFactory.getUserService();
 		User currentUser = userService.getCurrentUser();
 		attributesRequest.add("openid.return_to=" + return_url);
 
 		String loginUrl = userService.createLoginURL(return_url, request.getServerName(), openid_url, attributesRequest);
-		response.sendRedirect("loginUrl");
+		response.sendRedirect(loginUrl);
 	} else {
 %>
 <form id="openid_form" action="/login.jsp" method="post">