BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.security.LoginAction Class Reference
Inheritance diagram for org.turro.elephant.impl.security.LoginAction:
Collaboration diagram for org.turro.elephant.impl.security.LoginAction:

Public Member Functions

 LoginAction ()
 
int execute () throws Exception
 
void setMailServerUserPassword (String emailLogin, String emailPass)
 
- Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractAction
 AbstractAction ()
 
void setConstructor (IConstructor constructor)
 
IConstructor getConstructor ()
 
String getContextParameter ()
 
String getIdelParameter ()
 
String getActionParameter ()
 
String getParameter (String param)
 
String getParameter (String param, boolean encode)
 
String getStringParameter (String param)
 
String getValueParameter (String param)
 
boolean getBooleanParameter (String param)
 
int getIntParameter (String param, int defaultValue)
 
double getDoubleParameter (String param, double defaultValue)
 
Date getDateParameter (String param, Date defaultValue)
 

Additional Inherited Members

- Static Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractAction
static String makeDateParameter (Date date)
 
static String makeDateParameter (Timestamp date)
 
static String getValuePortion (String key, String value)
 
- Static Public Attributes inherited from org.turro.elephant.context.IAction
static final int DONE = 0
 
static final int NO_DATA = 1
 
static final int ERROR = 2
 
- Protected Attributes inherited from org.turro.elephant.impl.abstracts.AbstractAction
IConstructor constructor
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Deprecated:
Use Authentication instead

Definition at line 36 of file LoginAction.java.

Constructor & Destructor Documentation

◆ LoginAction()

org.turro.elephant.impl.security.LoginAction.LoginAction ( )

Creates a new instance of LoginAction

Definition at line 39 of file LoginAction.java.

39  {
40  }

Member Function Documentation

◆ execute()

int org.turro.elephant.impl.security.LoginAction.execute ( ) throws Exception

Called by constructor in request for one action.

Exceptions
java.lang.Exception
Returns
Action's result.

Implements org.turro.elephant.context.IAction.

Definition at line 43 of file LoginAction.java.

43  {
44  String action = getActionParameter(),
45  login = getParameter("login"),
46  pass = getParameter("pass");
47 
48  if ("login".equals(action)) {
49  IUser user = ContextFactory.getUser(constructor);
50  if (user.validate(login, pass)) {
51  constructor.setSessionAttribute(IUser.LOGGED_USER, user);
52  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, "/log/in", null, null);
53  } else {
54  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, "/log/failed", login, null);
55  }
56  String redir = getParameter("redir");
57  constructor.redirect(redir == null ? constructor.getLastReferringContext() : redir);
58  } else if ("logout".equals(action)) {
59  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, "/log/out", null, null);
61  constructor.removeSessionAttribute(IUser.LOGGED_USER);
62  String redir = getParameter("redir");
63  constructor.redirect(redir == null ? "/" : redir);
64  } else if ("profile".equals(action)) {
65  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, "/log/profile", null, null);
66  login = constructor.getUser().getId();
67  if (ContactPlugin.hasContacts()) {
68  ContactPlugin.saveChangesToContact(this);
69  } else {
70  IUserAdmin ua = ContextFactory.getUserAdmin(constructor);
71  String pass1 = getParameter("pass1"),
72  pass1r = getParameter("pass1r"),
73  pass2 = getParameter("pass2"),
74  pass2r = getParameter("pass2r"),
75  name = getParameter("name"),
76  email = getParameter("email"),
77  emailLogin = getParameter("emailLogin"),
78  emailPass = getParameter("emailPass"),
79  emailPassr = getParameter("emailPassr");
80  if (name != null) {
81  ua.setName(login, name);
82  }
83  if (pass1 != null && pass1.trim().length() > 0 && pass1.equals(pass1r)) {
84  if (pass2 == null || pass2.equals(pass2r)) {
85  ua.setPasswords(login, pass1, pass2);
86  }
87  }
88  if (email != null) {
89  ua.setProperty(login, IUser.CONNECTOR_EMAIL, email);
90  }
91  if (emailLogin != null && emailLogin.trim().length() > 0) {
92  if (emailPass != null && emailPass.trim().length() > 0 && emailPass.equals(emailPassr)) {
93  setMailServerUserPassword(emailLogin, emailPass);
94  }
95  }
96  }
97  IUser user = ContextFactory.getUser(constructor);
98  user.impersonate(login);
99  constructor.setSessionAttribute(IUser.LOGGED_USER, user);
101  }
102 
103  return IAction.DONE;
104  }
void setMailServerUserPassword(String emailLogin, String emailPass)
String getParameter(String param)
void setSessionAttribute(String key, Object value)
Here is the call graph for this function:

◆ setMailServerUserPassword()

void org.turro.elephant.impl.security.LoginAction.setMailServerUserPassword ( String  emailLogin,
String  emailPass 
)

Definition at line 106 of file LoginAction.java.

106  {
107  MailServer ms = (MailServer) ContextFactory.getImplementation(getConstructor(), "IMailServer");
108  if(ms != null) {
109  ms.changePassword(emailLogin, emailPass);
110  }
111  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: