Revision 34955
Added by Nikon Gasparis about 9 years ago
ActivateAccount.java | ||
---|---|---|
1 |
package eu.dnetlib.validator.admin.actions.users; |
|
2 |
|
|
3 |
import org.apache.log4j.Logger; |
|
4 |
|
|
5 |
import com.opensymphony.xwork2.Action; |
|
6 |
|
|
7 |
import eu.dnetlib.validator.admin.actions.BaseValidatorAction; |
|
8 |
|
|
9 |
public class ActivateAccount extends BaseValidatorAction { |
|
10 |
|
|
11 |
private static final long serialVersionUID = 4680016183168923054L; |
|
12 |
private Logger logger = Logger.getLogger(ActivateAccount.class); |
|
13 |
|
|
14 |
private String activationId; |
|
15 |
|
|
16 |
public String execute() { |
|
17 |
this.clearErrorsAndMessages(); |
|
18 |
try { |
|
19 |
logger.debug("activating user account with activation id " + activationId); |
|
20 |
if (this.getUserAPI().activateUser(this.getActivationId())) |
|
21 |
this.addActionMessage(this.getText("registration.okAccountActivation")); |
|
22 |
else |
|
23 |
this.addActionMessage(this.getText("registration.okAccountAlreadyActivation")); |
|
24 |
return Action.SUCCESS; |
|
25 |
} catch (Exception e) { |
|
26 |
logger.error("error activating user account with activation id " + activationId, e); |
|
27 |
this.addActionError(this.getText("generic.error")); |
|
28 |
reportException(e); |
|
29 |
return "exception"; |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
public void validate() { |
|
34 |
this.clearErrors(); |
|
35 |
if (this.getActivationId() == null || this.getActivationId().length() == 0) { |
|
36 |
this.addActionError(this.getText("noActivationId")); |
|
37 |
return; |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
public String getActivationId() { |
|
42 |
return activationId; |
|
43 |
} |
|
44 |
|
|
45 |
public void setActivationId(String activationId) { |
|
46 |
this.activationId = activationId; |
|
47 |
} |
|
48 |
} |
Also available in: Unified diff
*first BETA of validator admin panel
*written from scratch
*many new features
*based on the new version of validators db
*support for lareferencia