// Path: src/main/java/com/yyqian/imagine/constant/UriConstant.java
// public final class UriConstant {
// 
//   private UriConstant() {
//   }
// 
//   public static final String ABOUT = "/about";
//   public static final String LOGIN = "/login";
//   public static final String LOGIN_ERROR = LOGIN + "?error";
//   public static final String LOGOUT = "/logout";
//   public static final String FORGOT = "/forgot";
//   public static final String RESETPW = "/resetpw";
// 
//   public static final String POST = "/post";
//   public static final String POST_EDITOR = POST + "/new/editor";
//   public static final String COMMENT = "/comment";
//   public static final String USER = "/user";
//   public static final String USER_SELF = USER + "/self";
// }
// 
// Path: src/main/java/com/yyqian/imagine/dto/PasswordRestForm.java
// public class PasswordRestForm {
// 
//   @NotEmpty
//   @Size(min = 6, max = 20)
//   private String password = "";
// 
//   public PasswordRestForm() {
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password;
//   }
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/service/UserService.java
// public interface UserService {
// 
//   Optional<User> getUserById(long id);
// 
//   Optional<User> getUserByUsername(String username);
// 
//   Collection<User> getAllUsers();
// 
//   User create(UserCreateForm form);
// 
//   int increasePointByUserId(Long id);
// 
//   User update(UserUpdateForm form);
// 
//   User resetPassword(PasswordRestForm form);
// 
//   void sendRestPasswordEmail(String username);
// 
//   void authUserByToken(String token);
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/utility/ControllerUtil.java
// @Component
// public class ControllerUtil {
//   @Autowired
//   private SecurityService securityService;
// 
//   public void addLoginInfo(Model model) {
//     boolean isLoggedIn = securityService.isLoggedIn();
//     model.addAttribute("isLoggedIn", isLoggedIn);
//     if (isLoggedIn) {
//       model.addAttribute("username", securityService.getUsername());
//     }
//   }
// }
// 
// Path: src/main/java/com/yyqian/imagine/constant/UriConstant.java
// public final class UriConstant {
// 
//   private UriConstant() {
//   }
// 
//   public static final String ABOUT = "/about";
//   public static final String LOGIN = "/login";
//   public static final String LOGIN_ERROR = LOGIN + "?error";
//   public static final String LOGOUT = "/logout";
//   public static final String FORGOT = "/forgot";
//   public static final String RESETPW = "/resetpw";
// 
//   public static final String POST = "/post";
//   public static final String POST_EDITOR = POST + "/new/editor";
//   public static final String COMMENT = "/comment";
//   public static final String USER = "/user";
//   public static final String USER_SELF = USER + "/self";
// }


import com.yyqian.imagine.constant.UriConstant;
import com.yyqian.imagine.dto.PasswordRestForm;
import com.yyqian.imagine.service.UserService;
import com.yyqian.imagine.utility.ControllerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import static com.yyqian.imagine.constant.UriConstant.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
package com.yyqian.imagine.controller;




/**
 * Created by yyqian on 12/4/15.
 * Control all pages
 */
@Controller
public class PageController {

  private final UserService userService;
// Path: src/main/java/com/yyqian/imagine/constant/UriConstant.java
// public final class UriConstant {
// 
//   private UriConstant() {
//   }
// 
//   public static final String ABOUT = "/about";
//   public static final String LOGIN = "/login";
//   public static final String LOGIN_ERROR = LOGIN + "?error";
//   public static final String LOGOUT = "/logout";
//   public static final String FORGOT = "/forgot";
//   public static final String RESETPW = "/resetpw";
// 
//   public static final String POST = "/post";
//   public static final String POST_EDITOR = POST + "/new/editor";
//   public static final String COMMENT = "/comment";
//   public static final String USER = "/user";
//   public static final String USER_SELF = USER + "/self";
// }
// 
// Path: src/main/java/com/yyqian/imagine/dto/PasswordRestForm.java
// public class PasswordRestForm {
// 
//   @NotEmpty
//   @Size(min = 6, max = 20)
//   private String password = "";
// 
//   public PasswordRestForm() {
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password;
//   }
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/service/UserService.java
// public interface UserService {
// 
//   Optional<User> getUserById(long id);
// 
//   Optional<User> getUserByUsername(String username);
// 
//   Collection<User> getAllUsers();
// 
//   User create(UserCreateForm form);
// 
//   int increasePointByUserId(Long id);
// 
//   User update(UserUpdateForm form);
// 
//   User resetPassword(PasswordRestForm form);
// 
//   void sendRestPasswordEmail(String username);
// 
//   void authUserByToken(String token);
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/utility/ControllerUtil.java
// @Component
// public class ControllerUtil {
//   @Autowired
//   private SecurityService securityService;
// 
//   public void addLoginInfo(Model model) {
//     boolean isLoggedIn = securityService.isLoggedIn();
//     model.addAttribute("isLoggedIn", isLoggedIn);
//     if (isLoggedIn) {
//       model.addAttribute("username", securityService.getUsername());
//     }
//   }
// }
// 
// Path: src/main/java/com/yyqian/imagine/constant/UriConstant.java
// public final class UriConstant {
// 
//   private UriConstant() {
//   }
// 
//   public static final String ABOUT = "/about";
//   public static final String LOGIN = "/login";
//   public static final String LOGIN_ERROR = LOGIN + "?error";
//   public static final String LOGOUT = "/logout";
//   public static final String FORGOT = "/forgot";
//   public static final String RESETPW = "/resetpw";
// 
//   public static final String POST = "/post";
//   public static final String POST_EDITOR = POST + "/new/editor";
//   public static final String COMMENT = "/comment";
//   public static final String USER = "/user";
//   public static final String USER_SELF = USER + "/self";
// }


// Path: src/main/java/com/yyqian/imagine/controller/PageController.java
import com.yyqian.imagine.constant.UriConstant;
import com.yyqian.imagine.dto.PasswordRestForm;
import com.yyqian.imagine.service.UserService;
import com.yyqian.imagine.utility.ControllerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import static com.yyqian.imagine.constant.UriConstant.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

package com.yyqian.imagine.controller;




/**
 * Created by yyqian on 12/4/15.
 * Control all pages
 */
@Controller
public class PageController {

  private final UserService userService;
  private final ControllerUtil controllerUtil;