| | |
| | | // throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | // passwordService.validate(user, password, request); |
| | | passwordService.validate(user, password, request); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); |
| | | return userInfo; |
| | | } |
| | |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS,errMsg); |
| | | throw new ServiceException(errMsg); |
| | | } |
| | | // |
| | | // if (!matches(user,password)){ |
| | | // retryCount = retryCount + 1; |
| | | // recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | // redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | // throw new ServiceException("密码错误"); |
| | | // } |
| | | |
| | | if (!matches(user,password)){ |
| | | retryCount = retryCount + 1; |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | throw new ServiceException("密码错误"); |
| | | } |
| | | // if (!user.getPassword().equals(password)){ |
| | | // retryCount = retryCount + 1; |
| | | // recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
New file |
| | |
| | | package com.ruoyi.common.security.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | public class MD5Generator { |
| | | public static String generateMD5(String input) { |
| | | try { |
| | | // Create MD5 Hash |
| | | MessageDigest digest = MessageDigest.getInstance("MD5"); |
| | | digest.update(input.getBytes()); |
| | | byte messageDigest[] = digest.digest(); |
| | | |
| | | // Create Hex String |
| | | StringBuilder hexString = new StringBuilder(); |
| | | for (byte aMessageDigest : messageDigest) { |
| | | String h = Integer.toHexString(0xFF & aMessageDigest); |
| | | while (h.length() < 2) h = "0" + h; |
| | | hexString.append(h); |
| | | } |
| | | return hexString.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String myString = "968484"; |
| | | System.err.println("MD5 of '" + myString + "' is: " + generateMD5(myString)); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String encode = passwordEncoder.encode("123456"); |
| | | System.err.println(encode); |
| | | String s = encryptPassword("c4728bb7e093240deb97ccad908c3a26"); |
| | | System.err.println(s); |
| | | |
| | | System.err.println(matchesPassword("c4728bb7e093240deb97ccad908c3a26","$2a$10$FwoB7WcYuRMH1lyrSX8g2ed35MP6rpI4Qs3ITH24mEc9vV1D2x8Xq")); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.MD5Generator; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2)); |
| | | if(null == one){ |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | user.setObjectId(sysUser1.getObjectId()); |
| | | if(null != appUser){ |
| | |
| | | } |
| | | }else{ |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (user.getPassword() != null && !"".equals(user.getPassword())) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setPassWordUpdate(new Date()); |
| | | } |
| | | if (user.getPhonenumber() != null) { |
| | |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.MD5Generator; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.vo.VerifiableShopVo; |
| | |
| | | user.setRoleType(2); |
| | | user.setObjectId(shopId); |
| | | user.setAppUserId(appUser.getId()); |
| | | user.setPassword(phone.substring(5)); |
| | | String s = MD5Generator.generateMD5(phone.substring(5)); |
| | | user.setPassword(SecurityUtils.encryptPassword(s)); |
| | | user.setCreateTime(new Date()); |
| | | Long userId = sysUserClient.saveShopUser(user).getData(); |
| | | |
| | |
| | | @GetMapping("/getDetailById") |
| | | @ApiOperation(value = "门店详情", tags = {"管理后台-门店管理"}) |
| | | public R<Shop> getDetailById(@RequestParam("id") Integer id){ |
| | | Shop byId = shopService.getById(id); |
| | | return R.ok(byId); |
| | | Shop shop = shopService.getById(id); |
| | | if (shop.getPid()==0){ |
| | | shop.setPid(null); |
| | | } |
| | | return R.ok(shop); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteShop") |
| | |
| | | and ts.status = #{shop.status} |
| | | </if> |
| | | </where> |
| | | order by ts.create_time desc |
| | | order by ts.id desc |
| | | </select> |
| | | <select id="getShopStatistics" resultType="com.ruoyi.other.vo.ShopStatistics"> |
| | | SELECT |