新增是否开启用户注册功能
This commit is contained in:
		| @@ -0,0 +1,38 @@ | ||||
| package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.StringUtils; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.ruoyi.common.core.controller.BaseController; | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import com.ruoyi.common.core.domain.model.RegisterBody; | ||||
| import com.ruoyi.framework.web.service.SysRegisterService; | ||||
| import com.ruoyi.system.service.ISysConfigService; | ||||
|  | ||||
| /** | ||||
|  * 注册验证 | ||||
|  *  | ||||
|  * @author ruoyi | ||||
|  */ | ||||
| @RestController | ||||
| public class SysRegisterController extends BaseController | ||||
| { | ||||
|     @Autowired | ||||
|     private SysRegisterService registerService; | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysConfigService configService; | ||||
|  | ||||
|     @PostMapping("/register") | ||||
|     public AjaxResult register(@RequestBody RegisterBody user) | ||||
|     { | ||||
|         if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) | ||||
|         { | ||||
|             return error("当前系统没有开启注册功能!"); | ||||
|         } | ||||
|         String msg = registerService.register(user); | ||||
|         return StringUtils.isEmpty(msg) ? success() : error(msg); | ||||
|     } | ||||
| } | ||||
| @@ -19,6 +19,7 @@ user.password.not.valid=* 5-50个字符 | ||||
| user.email.not.valid=邮箱格式错误 | ||||
| user.mobile.phone.number.not.valid=手机号格式错误 | ||||
| user.login.success=登录成功 | ||||
| user.register.success=注册成功 | ||||
| user.notfound=请重新登录 | ||||
| user.forcelogout=管理员强制退出,请重新登录 | ||||
| user.unknown.error=未知错误,请重新登录 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user