Merge branch 'master' of gitee.com:kerwincui/wumei-smart

This commit is contained in:
xiaoyi
2021-08-17 11:44:05 +08:00
9 changed files with 87 additions and 47 deletions

View File

@@ -8,6 +8,7 @@
<version>3.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<!-- jar部署pom war部署war-->
<packaging>jar</packaging>
<artifactId>ruoyi-admin</artifactId>

View File

@@ -124,7 +124,7 @@ public class SysUserController extends BaseController
/**
* 新增用户
*/
// @PreAuthorize("@ss.hasPermi('system:user:add')")
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation(value = "新增用户", notes = "新增用户")
@@ -149,6 +149,33 @@ public class SysUserController extends BaseController
return toAjax(userService.insertUser(user));
}
/**
* 用户注册
*/
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/register")
@ApiOperation(value = "用户注册", notes = "用户注册")
public AjaxResult register(@Validated @RequestBody SysUser user)
{
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setDelFlag("0");
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/

View File

@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage").anonymous()
.antMatchers("/login", "/captchaImage","/system/user/register").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",
@@ -113,7 +113,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous()
.antMatchers("/system/user/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()