01: package ru.emdev.EmForge.security;
02:
03: import javax.faces.context.ExternalContext;
04: import javax.faces.context.FacesContext;
05: import javax.servlet.http.HttpServletRequest;
06:
07: import ru.emdev.EmForge.security.dao.UserDao;
08: import ru.emdev.EmForge.web.bean.BaseControllerImpl;
09: import ru.emdev.EmForge.web.bean.MainMenuController.MainMenuItem;
10: import ru.emdev.EmForge.wiki.web.bean.Crumb;
11:
12: public class RegActivationController extends BaseControllerImpl {
13: public static final String PAGE_NAME = "regactivation.faces";
14: public static final String TITLE = "Account Activation";
15: public static final String CODE_ATTR = "activationcode";
16:
17: private UserDao m_userDao;
18: private boolean m_isSuccess = false;
19:
20: public void setUserDao(UserDao i_userDao) {
21: m_userDao = i_userDao;
22: }
23:
24: @Override
25: public MainMenuItem getSelectionItemOnMainMenu() {
26: return MainMenuItem.TASKS;
27: }
28:
29: @Override
30: public String getTitleImpl() {
31: return TITLE;
32: }
33:
34: @Override
35: public Crumb getTrailCrumbInfo() {
36: return null;
37: }
38:
39: @Override
40: protected void init() {
41: ExternalContext context = FacesContext.getCurrentInstance()
42: .getExternalContext();
43: HttpServletRequest request = (HttpServletRequest) context
44: .getRequest();
45:
46: // get activation code
47: String activationCode = request.getParameter(CODE_ATTR);
48:
49: if (activationCode != null) {
50: // activate user
51: m_isSuccess = m_userDao.activateUser(activationCode);
52: }
53: }
54:
55: public boolean isSuccess() {
56: return m_isSuccess;
57: }
58:
59: }
|