mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 01:48:33 +08:00
changeUserPassword fix
This commit is contained in:
parent
1182fc3534
commit
78629720f7
@ -10,6 +10,8 @@ import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class UserInfoService extends JpaBaseService<UserInfo> {
|
||||
final static Logger _logger = LoggerFactory.getLogger(UserInfoService.class);
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@ -107,6 +110,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
||||
}
|
||||
String password = passwordEncoder.encode(PasswordReciprocal.getInstance().rawPassword(userInfo.getUsername(), userInfo.getPassword()));
|
||||
userInfo.setDecipherable(PasswordReciprocal.getInstance().rawPassword(userInfo.getUsername(), userInfo.getPassword()));
|
||||
_logger.debug("decipherable : "+userInfo.getDecipherable());
|
||||
userInfo.setPassword(password);
|
||||
userInfo.setPasswordLastSetTime(DateUtils.getCurrentDateTimeAsString());
|
||||
|
||||
|
||||
@ -46,10 +46,11 @@ public class SafeController {
|
||||
@RequestParam("newPassword") String newPassword,
|
||||
@RequestParam("confirmPassword") String confirmPassword) {
|
||||
|
||||
changeUserPassword(oldPassword,newPassword,confirmPassword);
|
||||
|
||||
if(changeUserPassword(oldPassword,newPassword,confirmPassword)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
}else {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_ERROR),MessageType.error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/changeExpiredPassword")
|
||||
@ -91,9 +92,11 @@ public class SafeController {
|
||||
String newPassword,
|
||||
String confirmPassword){
|
||||
UserInfo userInfo =WebContext.getUserInfo();
|
||||
_logger.debug("decipherable : "+userInfo.getDecipherable());
|
||||
_logger.debug("decipherable : "+PasswordReciprocal.getInstance().rawPassword(userInfo.getUsername(), userInfo.getPassword()));
|
||||
if(newPassword.equals(confirmPassword)){
|
||||
if(oldPassword==null ||
|
||||
userInfo.getPassword().equals(passwordEncoder.encode(PasswordReciprocal.getInstance().rawPassword(userInfo.getUsername(),oldPassword)))){
|
||||
passwordEncoder.matches(PasswordReciprocal.getInstance().rawPassword(userInfo.getUsername(),oldPassword), userInfo.getPassword())){
|
||||
userInfo.setPassword(newPassword);
|
||||
userInfoService.changePassword(userInfo);
|
||||
//TODO syncProvisioningService.changePassword(userInfo);
|
||||
|
||||
@ -4,9 +4,6 @@
|
||||
<li id="nav_primay_11" class="nav_primay_level primaryleft" xpath="">
|
||||
<a href="<@base/>/appList">我的应用</a>
|
||||
</li>
|
||||
<li id="nav_primay_12" class="nav_primay_level primaryleft" xpath="">
|
||||
<a href="<@base/>/socialsignon/list">认证关联</a>
|
||||
</li>
|
||||
<li id="nav_primay_13" class="nav_primay_level primaryleft" xpath="">
|
||||
<a href="<@base/>/safe/forward/setting">安全设置</a>
|
||||
<div id="nav_child_1301" class="nav_second_child">
|
||||
@ -15,6 +12,11 @@
|
||||
<a href="<@base/>/safe/forward/setting">安全设置</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li id="nav_second_1301" class="nav_second_level">
|
||||
<a href="<@base/>/socialsignon/list">认证关联</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li id="nav_second_1302" class="nav_second_level">
|
||||
<a href="<@base/>/safe/forward/changePasswod">密码修改</a>
|
||||
|
||||
@ -37,24 +37,19 @@
|
||||
<th><@locale code="login.password.oldPassword" /> :</th>
|
||||
<td>
|
||||
<input class="form-control" type="password" id="oldPassword" name="oldPassword" class="required" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="oldPassword"></label>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><@locale code="login.password.newPassword" />:</th>
|
||||
<td>
|
||||
<input class="form-control" type="password" id="newPassword" name="newPassword" class=" required" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="newPassword"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><@locale code="login.password.confirmPassword" />:</th>
|
||||
<td nowrap>
|
||||
<input class="form-control" type="password" id="confirmPassword" name="confirmPassword" class="{ required: true, equalTo: '#newPassword' }" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="confirmPassword"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -37,24 +37,19 @@
|
||||
<th><@locale code="login.password.oldPassword" /> :</th>
|
||||
<td>
|
||||
<input class="form-control" type="password" id="oldPassword" name="oldPassword" class="required" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="oldPassword"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><@locale code="login.password.newPassword" />:</th>
|
||||
<td>
|
||||
<input class="form-control" type="password" id="newPassword" name="newPassword" class=" required" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="newPassword"></label>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><@locale code="login.password.confirmPassword" />:</th>
|
||||
<td nowrap>
|
||||
<input class="form-control" type="password" id="confirmPassword" name="confirmPassword" class="{ required: true, equalTo: '#newPassword' }" title="" value=""/>
|
||||
<b class="orange">*</b>
|
||||
<label for="confirmPassword"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user