1 package org.appfuse.webapp.pages;
2
3 import org.apache.tapestry5.alerts.AlertManager;
4 import org.apache.tapestry5.annotations.InjectPage;
5 import org.apache.tapestry5.annotations.Persist;
6 import org.apache.tapestry5.annotations.Property;
7 import org.apache.tapestry5.ioc.Messages;
8 import org.apache.tapestry5.ioc.annotations.Inject;
9 import org.appfuse.model.User;
10 import org.appfuse.webapp.services.SecurityContext;
11 import org.slf4j.Logger;
12
13
14
15
16
17
18
19
20 public class Home {
21
22 @Inject
23 private Logger logger;
24
25 @Inject
26 private Messages messages;
27
28 @Inject
29 private SecurityContext securityContext;
30
31 @Inject
32 private AlertManager alertManager;
33
34 @InjectPage
35 private UserEdit userEdit;
36
37 @Persist
38 @Property
39 private User currentUser;
40
41 Object onActionFromEditProfile() {
42 logger.debug("Editing current user's profile");
43 currentUser = securityContext.getUser();
44 if (currentUser == null) {
45 logger.debug("Current User is null - this is unexpected");
46 return this;
47 }
48 logger.debug(String.format("Current User is %s", currentUser.getUsername()));
49 currentUser.setConfirmPassword(currentUser.getPassword());
50 return userEdit.initialize(currentUser, "main", messages.get("userProfile.message"));
51 }
52 }