Revision 36:f607fc07f2c2
src/main/java/my/com/upass/MinimalUPassControllerV2.java | ||
---|---|---|
141 | 141 |
} |
142 | 142 |
|
143 | 143 |
public int addUser(String appAccessId, String hashedSecretKey, MinimalUserBean user, Session txSession) { |
144 |
return addUser(appAccessId, hashedSecretKey, user, txSession, true); |
|
145 |
} |
|
146 |
|
|
147 |
public int addUser(String appAccessId, String hashedSecretKey, MinimalUserBean user, Session txSession, boolean checkPassword) { |
|
144 | 148 |
|
145 | 149 |
final String userAlias = user.getUserAlias(); |
146 | 150 |
final String doubleHashedPassword = user.getPcipherText(); |
... | ... | |
159 | 163 |
else { |
160 | 164 |
user.setUserType(MinimalConstants.UTYPE_STATE_USER); |
161 | 165 |
user.setPstate(MinimalConstants.UID_STATE_ACTIVE); |
162 |
rc = createUserService.addUser(user, appId.intValue(), txSession); |
|
166 |
rc = createUserService.addUser(user, appId.intValue(), txSession, checkPassword);
|
|
163 | 167 |
} |
164 | 168 |
|
165 | 169 |
} catch (MultipleAppAccessesFound e) { |
src/main/java/my/com/upass/pojo/MinimalUserBean.java | ||
---|---|---|
28 | 28 |
private String phistoryList; |
29 | 29 |
private int pexpiredStatus; |
30 | 30 |
private Date pdateExpired; |
31 |
private Integer applicationId; |
|
31 |
//private Integer applicationId;
|
|
32 | 32 |
|
33 | 33 |
// |
34 | 34 |
|
... | ... | |
208 | 208 |
this.pdateExpired = pdateExpired; |
209 | 209 |
} |
210 | 210 |
|
211 |
public Integer getApplicationId() { |
|
212 |
return applicationId; |
|
213 |
} |
|
214 |
|
|
215 |
public void setApplicationId(Integer applicationId) { |
|
216 |
this.applicationId = applicationId; |
|
217 |
} |
|
211 |
// public Integer getApplicationId() {
|
|
212 |
// return applicationId;
|
|
213 |
// }
|
|
214 |
// |
|
215 |
// public void setApplicationId(Integer applicationId) {
|
|
216 |
// this.applicationId = applicationId;
|
|
217 |
// }
|
|
218 | 218 |
|
219 | 219 |
// Helper methods |
220 | 220 |
|
src/main/java/my/com/upass/services/CreateUserService.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
public int addUser( |
49 | 49 |
String userAlias, int userType, String userDesc, |
50 |
String userPassword, int userState, int applicationId, Session txSession) { |
|
50 |
String userPassword, int userState, int applicationId, Session txSession, boolean checkPassword) {
|
|
51 | 51 |
|
52 | 52 |
int rc = MinimalConstants.ERR_SYSTEM_NOT_READY; |
53 | 53 |
|
54 |
if (userAlias == null || userPassword == null) {
|
|
54 |
if (userAlias == null) { |
|
55 | 55 |
return MinimalConstants.ERR_INVALID_INPUT; |
56 | 56 |
} |
57 |
|
|
58 |
if(checkPassword && userPassword == null){ |
|
59 |
return MinimalConstants.ERR_INVALID_INPUT; |
|
60 |
} |
|
61 |
|
|
57 | 62 |
UserDAO userDao; |
58 | 63 |
try { |
59 | 64 |
userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
... | ... | |
71 | 76 |
ub.setUstate(userState); |
72 | 77 |
ub.setUdateCreated(new Date()); |
73 | 78 |
ub.setPdateCreated(new Date()); |
74 |
ub.setApplicationId(new Integer(applicationId));
|
|
79 |
//ub.setApplicationId(new Integer(applicationId)); //has been moved to UserAppAccess
|
|
75 | 80 |
|
76 | 81 |
PasswordController pc = MinimalUPassFactory.getPasswordController(ub, |
77 | 82 |
upc.getConfigurationsMap()); |
... | ... | |
81 | 86 |
return rc; |
82 | 87 |
} |
83 | 88 |
|
84 |
rc = pc.GeneratePassword(userPassword, true); |
|
85 |
|
|
86 |
if (rc != MinimalConstants.ERR_SUCCESS) { |
|
87 |
return rc; |
|
89 |
if(checkPassword){ |
|
90 |
rc = pc.GeneratePassword(userPassword, true); |
|
91 |
|
|
92 |
if (rc != MinimalConstants.ERR_SUCCESS) { |
|
93 |
return rc; |
|
94 |
} |
|
88 | 95 |
} |
96 |
|
|
89 | 97 |
ub = (MinimalUserBean) pc.getUpdatedObject(); |
90 | 98 |
|
91 | 99 |
// UserMasterBean master = new UserMasterBean (); |
... | ... | |
123 | 131 |
|
124 | 132 |
public int addUser( |
125 | 133 |
String userAlias, int userType, String userDesc, |
134 |
String userPassword, int userState, int applicationId, Session txSession) { |
|
135 |
return addUser(userAlias, userType, userDesc, userPassword, userState, applicationId, txSession, true); |
|
136 |
} |
|
137 |
|
|
138 |
public int addUser( |
|
139 |
String userAlias, int userType, String userDesc, |
|
126 | 140 |
String userPassword, int userState, int applicationId) { |
127 | 141 |
|
128 | 142 |
return addUser(userAlias, userType, userDesc, userPassword, userState, applicationId, null); |
129 | 143 |
} |
130 | 144 |
|
131 |
public int addUser(MinimalUserBean user, int appId, Session txSession) { |
|
145 |
public int addUser(MinimalUserBean user, int appId, Session txSession, boolean checkPassword) {
|
|
132 | 146 |
return addUser( |
133 | 147 |
user.getUserAlias(), user.getUserType(), user.getDescription(), |
134 |
user.getPcipherText(), user.getPstate(), appId, txSession); |
|
148 |
user.getPcipherText(), user.getPstate(), appId, txSession, checkPassword);
|
|
135 | 149 |
} |
136 | 150 |
} |
src/main/resources/my/com/upass/hibernate/TbAmUser.hbm.xml | ||
---|---|---|
74 | 74 |
<!-- <property name="ucustomerType" type="string"> --> |
75 | 75 |
<!-- <column name="U_CUSTOMER_TYPE" length="10" /> --> |
76 | 76 |
<!-- </property> --> |
77 |
<!-- |
|
77 | 78 |
<property name="applicationId" type="integer"> |
78 | 79 |
<column name="U_APPLICATION_ID" precision="6" not-null="false" /> |
79 | 80 |
</property> |
81 |
--> |
|
80 | 82 |
|
81 | 83 |
</class> |
82 | 84 |
</hibernate-mapping> |
Also available in: Unified diff