pull/1121/head
parent
307f6d885d
commit
6e68cffdf9
|
|
@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "验证码")
|
||||
@Api(tags = "图形验证码")
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/captcha")
|
||||
public class CaptchaController {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.ruoyi.web.controller.system;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
|
@ -139,6 +141,28 @@ public class SysLoginController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注销登录(退出登录)")
|
||||
@GetMapping("/logout")
|
||||
public R logout() {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "删除账号", businessType = BusinessType.DELETE)
|
||||
@ApiOperation(value = "注销账号(删除当前登录账号)")
|
||||
@PostMapping("/user/remove")
|
||||
public R removeCurrentUser(@Validated @RequestBody LoginBySmsCodeVO vo) {
|
||||
loginService.validateSmsVerificationCode(vo.getPhoneNumber(), vo.getCode());
|
||||
UserExt currentUser = SecurityUtils.getLoginUser().getUser();
|
||||
Assert.notNull(currentUser);
|
||||
String phoneNumber = currentUser.getPhonenumber();
|
||||
Assert.isTrue(StrUtil.equals(vo.getPhoneNumber(), phoneNumber), "手机号与账号不匹配");
|
||||
userService.batchDeleteUser(Collections.singletonList(currentUser.getUserId()));
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(Collections.singletonList(currentUser.getUserId()));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "修改密码", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation(value = "修改密码(使用手机验证码修改)")
|
||||
@PostMapping("/changePassword")
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class SecurityConfig
|
|||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
.logout(logout -> logout.logoutUrl("/rest/v1/login/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
|
|
|
|||
Loading…
Reference in New Issue