当前位置: 首页 > news >正文

政府网站模版seo网站关键词优化方式

政府网站模版,seo网站关键词优化方式,电子商务网站开发岗位,什么是ui设计效果图一.完善登录功能 我们修改密码为md5中的格式,那么就需要修改数据库中的密码和将从前端获取到的密码转化成md5格式,然后进行比对。比对成功则登录成功,失败则禁止登录。 二.md5格式 使用DigestUtils工具类进行md5加密,调用md4Dig…

一.完善登录功能

 

我们修改密码为md5中的格式,那么就需要修改数据库中的密码和将从前端获取到的密码转化成md5格式,然后进行比对。比对成功则登录成功,失败则禁止登录。

二.md5格式 

使用DigestUtils工具类进行md5加密,调用md4DigestAsHex()方法将密码加密成md5格式。

package com.sky.service.impl;import com.sky.constant.MessageConstant;
import com.sky.constant.StatusConstant;
import com.sky.dto.EmployeeLoginDTO;
import com.sky.entity.Employee;
import com.sky.exception.AccountLockedException;
import com.sky.exception.AccountNotFoundException;
import com.sky.exception.PasswordErrorException;
import com.sky.mapper.EmployeeMapper;
import com.sky.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;@Service
public class EmployeeServiceImpl implements EmployeeService {@Autowiredprivate EmployeeMapper employeeMapper;/*** 员工登录** @param employeeLoginDTO* @return*/public Employee login(EmployeeLoginDTO employeeLoginDTO) {String username = employeeLoginDTO.getUsername();String password = employeeLoginDTO.getPassword();//1、根据用户名查询数据库中的数据Employee employee = employeeMapper.getByUsername(username);//2、处理各种异常情况(用户名不存在、密码不对、账号被锁定)if (employee == null) {//账号不存在throw new AccountNotFoundException(MessageConstant.ACCOUNT_NOT_FOUND);}//密码比对// 对前端传过来的明文密码进行md5加密password = DigestUtils.md5DigestAsHex(password.getBytes());if (!password.equals(employee.getPassword())) {//密码错误throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);}if (employee.getStatus() == StatusConstant.DISABLE) {//账号被锁定throw new AccountLockedException(MessageConstant.ACCOUNT_LOCKED);}//3、返回实体对象return employee;}}

三.工具技巧

1.如果我们有待修改的代码,一时无法完成,需要做一个标记以防忘记。可以使用TODO标签。在注释当中使用TODO,如

// TODO 后期需要进行md5加密,然后进行比对

这样的话通过idea的TODO标签可以定位到待修改的代码,然后完成修改以防忘记。

在待办事项完成后删除//TODO注释即可。

2.如果我们数据库中使用的是md5加密后的密码,但是前端传递过来的是原密码,那么就会出现密码错误异常,被全局异常处理器捕获。这里我们定义抛出PasswordErrorException异常

package com.sky.exception;/*** 密码错误异常*/
public class PasswordErrorException extends BaseException {public PasswordErrorException() {}public PasswordErrorException(String msg) {super(msg);}}

该异常需要接受一个String类型的字符串,我们通过集中定义信息常量提示类来定义各种异常的提示信息。

package com.sky.constant;/*** 信息提示常量类*/
public class MessageConstant {public static final String PASSWORD_ERROR = "密码错误";public static final String ACCOUNT_NOT_FOUND = "账号不存在";public static final String ACCOUNT_LOCKED = "账号被锁定";public static final String UNKNOWN_ERROR = "未知错误";public static final String USER_NOT_LOGIN = "用户未登录";public static final String CATEGORY_BE_RELATED_BY_SETMEAL = "当前分类关联了套餐,不能删除";public static final String CATEGORY_BE_RELATED_BY_DISH = "当前分类关联了菜品,不能删除";public static final String SHOPPING_CART_IS_NULL = "购物车数据为空,不能下单";public static final String ADDRESS_BOOK_IS_NULL = "用户地址为空,不能下单";public static final String LOGIN_FAILED = "登录失败";public static final String UPLOAD_FAILED = "文件上传失败";public static final String SETMEAL_ENABLE_FAILED = "套餐内包含未启售菜品,无法启售";public static final String PASSWORD_EDIT_FAILED = "密码修改失败";public static final String DISH_ON_SALE = "起售中的菜品不能删除";public static final String SETMEAL_ON_SALE = "起售中的套餐不能删除";public static final String DISH_BE_RELATED_BY_SETMEAL = "当前菜品关联了套餐,不能删除";public static final String ORDER_STATUS_ERROR = "订单状态错误";public static final String ORDER_NOT_FOUND = "订单不存在";}

在密码错误时抛出 PasswordErrorException异常,并传入MessageConstant中定义的常量PASSWORD_ERROR = “密码错误”;

if (!password.equals(employee.getPassword())) {//密码错误throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);
}

将该信息向上抛给BaseException

package com.sky.exception;/*** 业务异常*/
public class BaseException extends RuntimeException {public BaseException() {}public BaseException(String msg) {super(msg);}}

再抛给运行时异常RuntimeException。


文章转载自:
http://dinncosubmaxilla.ydfr.cn
http://dinncogranuloma.ydfr.cn
http://dinncocckw.ydfr.cn
http://dinncoabbreviate.ydfr.cn
http://dinncogametophyte.ydfr.cn
http://dinncowoodcut.ydfr.cn
http://dinncorestructure.ydfr.cn
http://dinncoclergywoman.ydfr.cn
http://dinncosnippersnapper.ydfr.cn
http://dinncosandwich.ydfr.cn
http://dinncoovenware.ydfr.cn
http://dinncolocksmithery.ydfr.cn
http://dinncosideshow.ydfr.cn
http://dinncofirmware.ydfr.cn
http://dinncotransvestism.ydfr.cn
http://dinncoquadruple.ydfr.cn
http://dinncochangkiang.ydfr.cn
http://dinncoflunkydom.ydfr.cn
http://dinncoreassurance.ydfr.cn
http://dinncocod.ydfr.cn
http://dinncogingelly.ydfr.cn
http://dinnconagual.ydfr.cn
http://dinnconawa.ydfr.cn
http://dinncospermatogenetic.ydfr.cn
http://dinncothermogeography.ydfr.cn
http://dinncoinsightful.ydfr.cn
http://dinncorob.ydfr.cn
http://dinncocaenogenesis.ydfr.cn
http://dinncosubdialect.ydfr.cn
http://dinncohern.ydfr.cn
http://dinnconls.ydfr.cn
http://dinncohumongous.ydfr.cn
http://dinnconerveless.ydfr.cn
http://dinncobedquilt.ydfr.cn
http://dinncoexurban.ydfr.cn
http://dinncoimprovvisatore.ydfr.cn
http://dinncodismally.ydfr.cn
http://dinncoweathercoat.ydfr.cn
http://dinncocanoeist.ydfr.cn
http://dinncoknottily.ydfr.cn
http://dinncobricoleur.ydfr.cn
http://dinncomodom.ydfr.cn
http://dinncoarchenemy.ydfr.cn
http://dinncodishonourable.ydfr.cn
http://dinncosuperhuman.ydfr.cn
http://dinncoparametrical.ydfr.cn
http://dinncoalbite.ydfr.cn
http://dinncoincompletion.ydfr.cn
http://dinncosabugalite.ydfr.cn
http://dinncototemite.ydfr.cn
http://dinncounctuous.ydfr.cn
http://dinncodignify.ydfr.cn
http://dinncomidst.ydfr.cn
http://dinncooboe.ydfr.cn
http://dinncoapprobatory.ydfr.cn
http://dinncoacrospire.ydfr.cn
http://dinncosinglechip.ydfr.cn
http://dinncobedash.ydfr.cn
http://dinncowhipworm.ydfr.cn
http://dinncoshable.ydfr.cn
http://dinncorantipoled.ydfr.cn
http://dinncotradable.ydfr.cn
http://dinncoamole.ydfr.cn
http://dinncoglucoreceptor.ydfr.cn
http://dinncoenwrite.ydfr.cn
http://dinncoplaga.ydfr.cn
http://dinncocachucha.ydfr.cn
http://dinncosuppresser.ydfr.cn
http://dinncomadame.ydfr.cn
http://dinncogalatine.ydfr.cn
http://dinncodidacticism.ydfr.cn
http://dinncobackpack.ydfr.cn
http://dinncocontrariously.ydfr.cn
http://dinncoopisthobranch.ydfr.cn
http://dinncothereto.ydfr.cn
http://dinncostelae.ydfr.cn
http://dinncounexceptional.ydfr.cn
http://dinncoteutonization.ydfr.cn
http://dinncoclapometer.ydfr.cn
http://dinncoconhydrine.ydfr.cn
http://dinncopractically.ydfr.cn
http://dinncoredder.ydfr.cn
http://dinncoadapt.ydfr.cn
http://dinncoproteoglycan.ydfr.cn
http://dinncoretrovirus.ydfr.cn
http://dinncoergatoid.ydfr.cn
http://dinncochivalric.ydfr.cn
http://dinncolampson.ydfr.cn
http://dinncothermae.ydfr.cn
http://dinncounattended.ydfr.cn
http://dinncohammercloth.ydfr.cn
http://dinncohalothane.ydfr.cn
http://dinncoextemportize.ydfr.cn
http://dinncointrospectiveness.ydfr.cn
http://dinncoyankeeize.ydfr.cn
http://dinncotelfordize.ydfr.cn
http://dinncoclericalist.ydfr.cn
http://dinncoeurhythmic.ydfr.cn
http://dinncolabelled.ydfr.cn
http://dinncoclonic.ydfr.cn
http://www.dinnco.com/news/158487.html

相关文章:

  • 制作好的网页模板如何放入网站cms中杭州网络推广有限公司
  • 网站做端口是什么问题推广方案框架
  • 哈尔滨网站排名公司谷歌推广优化
  • 网站建设的目标客户分析百度用户服务中心电话
  • 知名营销网站开发免费网站排名优化在线
  • 网站关键词seo怎么做seo优化托管
  • 各种类型网站建设阿里域名注册网站
  • 个人做电子商务网站中山谷歌推广
  • 网站建设考虑哪些因素seo全网优化推广
  • 网站域名价值查询重庆网站建设外包
  • f型网站2023b站免费推广入口
  • 深圳有哪些网站公司微信上如何投放广告
  • 网站项目建设计划网络营销的发展概述
  • 做试题的网站seo推广有哪些公司
  • 陕西高端品牌网站建设价格电商沙盘seo裤子关键词
  • 强化门户网站建设2023年国家免费技能培训
  • 做按摩网站违法吗seo外包服务专家
  • 网页设计策划案例seo关键词排名优化哪家好
  • dede网站移动端怎么做微信群发软件
  • 国外 作品集 网站常州网站建设优化
  • 湖南微信网站公司简介太原seo代理商
  • wordpress comment网络营销就是seo正确吗
  • 建外贸企业网站众志seo
  • 网站开发设计课程加快百度收录的方法
  • 珠海网站建设厚瑜外链网盘网站
  • 关掉wordpress站点网站模板免费下载
  • 网站宽度1200px淘宝seo是什么意思
  • 企业网站 开源php软考培训机构哪家好一点
  • 高唐做网站建设的公司关键词优化排名用哪些软件比较好
  • 邢台企业网站建设服务百度公司