-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResetPassword.java
More file actions
89 lines (67 loc) · 2.16 KB
/
ResetPassword.java
File metadata and controls
89 lines (67 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.appsecco.dvja.controllers;
import com.appsecco.dvja.services.UserService;
import org.apache.commons.lang.StringUtils;
public class ResetPassword extends BaseController {
private UserService userService;
private String key;
private String login;
private String password;
private String passwordConfirmation;
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPasswordConfirmation() {
return passwordConfirmation;
}
public void setPasswordConfirmation(String passwordConfirmation) {
this.passwordConfirmation = passwordConfirmation;
}
public String requestResetPassword() {
if(StringUtils.isEmpty(getLogin()))
return INPUT;
// Execute reset password request
return SUCCESS;
}
public String execute() {
if(StringUtils.isEmpty(getLogin()) || StringUtils.isEmpty(getKey()))
addActionError("Login or key parameter missing");
if(StringUtils.isEmpty(getLogin()) || StringUtils.isEmpty(getKey()) ||
StringUtils.isEmpty(getPassword()) || StringUtils.isEmpty(getPasswordConfirmation()))
return INPUT;
boolean ret = false;
try {
ret = userService.resetPasswordByLogin(getLogin(), getKey(),
getPassword(), getPasswordConfirmation());
}
catch(Exception e) {
addActionError("Exception ocurred: " + e.getMessage());
return INPUT;
}
if(!ret) {
addActionError("Error occurred while changing password");
return INPUT;
}
return SUCCESS;
}
}