| | |
| | | |
| | | import com.vincent.rsf.common.enums.SystemModeType; |
| | | import com.vincent.rsf.common.utils.Utils; |
| | | import com.vincent.rsf.framework.common.BaseRes; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | |
| | | import com.vincent.rsf.server.common.service.EmailService; |
| | | import com.vincent.rsf.server.common.utils.JwtUtil; |
| | | import com.vincent.rsf.server.system.controller.param.LoginParam; |
| | | import com.vincent.rsf.server.system.controller.param.RegisterParam; |
| | | import com.vincent.rsf.server.system.controller.param.UpdatePasswordParam; |
| | | import com.vincent.rsf.server.system.controller.result.LoginResult; |
| | | import com.vincent.rsf.server.system.controller.result.MenuVo; |
| | |
| | | import com.vincent.rsf.server.system.entity.Tenant; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import com.vincent.rsf.server.system.entity.UserLogin; |
| | | import com.vincent.rsf.server.system.enums.EmailType; |
| | | import com.vincent.rsf.server.system.enums.StatusType; |
| | | import com.vincent.rsf.server.system.service.RoleMenuService; |
| | | import com.vincent.rsf.server.system.service.TenantService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @PostMapping("/login") |
| | | public R login(@RequestBody LoginParam param, HttpServletRequest request) { |
| | | // System.out.println(userService.encodePassword("123456")); |
| | | // emailService.sendVerificationEmail("t1341870251@gmail.com", "123456"); |
| | | |
| | | String username = param.getUsername(); |
| | | Long tenantId = param.getTenantId(); |
| | | User user = userService.getByUsername(username, tenantId); |
| | |
| | | return R.ok("Sign In Success").add(new LoginResult(accessToken, user, tenant.getName())); |
| | | } |
| | | |
| | | @GetMapping("/email/code") |
| | | public R emailCode(@RequestParam("email") String email) { |
| | | if (Cools.isEmpty(email)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | String code = Utils.randomNumbers(configProperties.getCodeLength()); |
| | | emailService.sendEmail(email, EmailType.REGISTER_VERIFY, Cools.add("code", code)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/register") |
| | | public R register(@RequestBody RegisterParam param, HttpServletRequest request) { |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/system/info") |
| | | public R systemInfo() { |
| | | SystemModeType systemMode = configProperties.getSystemMode(); |