处理密码明文,防止密码被别人获取破坏系统
MD5加密是单向的不可逆的 ,不能由加密后的换算加密前的
- //密码比对
- password = DigestUtils.md5DigestAsHex ( password.getBytes () );
- // 对前端传来的密码进行md5加密后期需要进行md5加密,然后再进行比对
- if (!password.equals(employee.getPassword())) {
- //密码错误
- throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);
- }
-
- if (employee.getStatus() == StatusConstant.DISABLE) {
- //账号被锁定
- throw new AccountLockedException(MessageConstant.ACCOUNT_LOCKED);
- }
- /**
- * 通过knife4j生成接口文档
- * @return
- */
- @Bean
- public Docket docket() {
- ApiInfo apiInfo = new ApiInfoBuilder()
- .title("苍穹外卖项目接口文档")
- .version("2.0")
- .description("苍穹外卖项目接口文档")
- .build();
- Docket docket = new Docket(DocumentationType.SWAGGER_2)
- .apiInfo(apiInfo)
- .select()
- .apis(RequestHandlerSelectors.basePackage("com.sky.controller"))
- .paths(PathSelectors.any())
- .build();
- return docket;
- }
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
- registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
- }
由Swagger生成的接口文档