当前位置:网站首页 > R语言数据分析 > 正文

登录和注册(四)重新修改密码页——清除session之sessionStorage.removeItem

登录和注册(四)重新修改密码页——清除session之sessionStorage.removeItem

效果

在这里插入图片描述

代码

src\views\changPasswordP.vue

<template> <div id="changPasswordP"> <p class="changPasswordPTop">请重新修改密码</p> <ul> <li> <p>账号</p><b>:</b><input type="text" disabled v-model="IphoneNumber"> </li> <li> <p><span>*</span>原密码</p><b>:</b><input type="password" @blur="pwd()" v-model="OldPassword"> </li> <p style="position:absolute;color: red;font-size: 12px;margin-left: 90px;margin-top: -9px;">{ 
  { yuanmi }}</p> <li> <p><span>*</span>新密码</p><b>:</b><input type="password" @blur="pwds()" v-model="NewPassword" id="xin"> </li> <p style="position:absolute;color: red;font-size: 12px;margin-left: 90px;margin-top: -9px;">{ 
  { xinmi }}</p> <li> <p><span>*</span>确认密码</p><b>:</b><input type="password" @blur="bul()" v-model="SurePassword" id="que"> </li> <p style="position:absolute;color: red;font-size: 12px;margin-left: 90px;margin-top: -9px;">{ 
  { quemi }}</p> </ul> <div class="changPasswordP"> <el-button type="primary" link @click="cancal">取消</el-button> <el-button type="primary" @click="reset">重置</el-button> </div> </div> </template> <script> import { inject } from "vue"; import { post } from "@/utils/path"; import * as allCookie from '../utils/utils.js'; export default { data() { return { yuanmi: "", xinmi: "", quemi: "", IphoneNumber: window.sessionStorage.getItem("IphoneNumber"), OldPassword: "", NewPassword: "", SurePassword: "", enPwd: "", enPwds: "", constant: inject('constant'), $message: inject('message') } }, methods: { pwd() { if (this.OldPassword == '') { this.yuanmi = '请输入原密码'; return false; } else { var pwd = this.OldPassword var key = generateSM4Key() var cipherText = SM4Encrypt(pwd, key); var cipherKey = SG_sm2Encrypt(key, "045305e570ba7c50795aadfeb1396f84cb22ec788d81e7bd1cd6b51c9e53680c942bf9b3614a658aa5921c0920bacf6a3070e007bf217d70"); this.enPwd = cipherKey + ',' + cipherText; this.yuanmi = '' return true } }, pwds() { var mys = /(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=([!-~]+)[^a-zA-Z0-9])/g; if (this.NewPassword == '') { this.xinmi = '请输入新密码'; return false; } else if (!mys.test(this.NewPassword)) { this.xinmi = '必须包含大小写字母、数字、特殊字符,长度为8-20'; return false; } else if (this.NewPassword.length < 8 || this.NewPassword.length > 20) { this.xinmi = '必须包含大小写字母、数字、特殊字符,长度为8-20'; return false; } else if (this.IphoneNumber == this.NewPassword) { this.xinmi = '用户名密码相同,请重新填写'; return false; } else if (this.NewPassword.indexOf(this.IphoneNumber) != '-1') { this.xinmi = '密码中含有用户名,请重新填写'; return false; } else if (this.OldPassword == this.NewPassword) { this.xinmi = '新密码和原密码相同' return false; } else { var pwd = this.NewPassword var key = generateSM4Key() var cipherText = SM4Encrypt(pwd, key); var cipherKey = SG_sm2Encrypt(key, "045305e570ba7c50795aadfeb1396f84cb22ec788d81e7bd1cd6b51c9e53680c942bf9b3614a658aa5921c0920bacf6a3070e007bf217d70"); this.enPwds = cipherKey + ',' + cipherText; this.xinmi = '' return true } }, bul() { var xin = document.getElementById("xin").value; var que = document.getElementById("que").value; if (this.SurePassword == '') { this.quemi = "请再次输入密码"; return false; } else if (xin == que) { this.quemi = ""; return true; } else { this.quemi = "两次输入的密码不一致"; return false; } }, // 取消 cancal() { window.sessionStorage.removeItem('roles'); window.sessionStorage.removeItem('tokenId'); window.sessionStorage.removeItem('userName'); window.sessionStorage.removeItem('userType'); window.sessionStorage.removeItem('companyType'); window.sessionStorage.removeItem('userId'); window.sessionStorage.removeItem('status'); window.sessionStorage.removeItem('isSgcc'); window.sessionStorage.removeItem('Web-Token'); window.sessionStorage.removeItem('ser'); window.sessionStorage.removeItem('userRealName'); window.sessionStorage.removeItem('deptname'); window.sessionStorage.removeItem('parentName'); window.sessionStorage.removeItem('parentId'); window.sessionStorage.removeItem('custId'); allCookie.CookieRemove("web_token"); this.$router.back() }, // 重置 reset() { if (!this.pwd() || !this.pwds() || !this.bul()) { return } else { var that = this; post(this.constant.publicCoop + "/users/primordialpass/edit", { "tokenId": window.sessionStorage.getItem("IphoneTokenId"), "oldCertificate": this.enPwd, "newCertificate": this.enPwds }).then(function (res) { if (res.data.result == 0) { window.sessionStorage.removeItem('roles'); window.sessionStorage.removeItem('tokenId'); window.sessionStorage.removeItem('userName'); window.sessionStorage.removeItem('userType'); window.sessionStorage.removeItem('companyType'); window.sessionStorage.removeItem('userId'); window.sessionStorage.removeItem('status'); window.sessionStorage.removeItem('isSgcc'); window.sessionStorage.removeItem('Web-Token'); window.sessionStorage.removeItem('ser'); window.sessionStorage.removeItem('userRealName'); window.sessionStorage.removeItem('deptname'); window.sessionStorage.removeItem('parentName'); window.sessionStorage.removeItem('parentId'); window.sessionStorage.removeItem('custId'); allCookie.CookieRemove("web_token"); if (that.isIsc) { that.$router.push("/loginOutSide") } else { that.$router.push("/login") } } else { that.$message.error(res.data.message) } }) } } } } </script> <style lang="scss"> #changPasswordP { width: 1200px; height: 450px; margin: 20px auto; .changPasswordPTop { width: 726px; height: 100px; line-height: 100px; margin: auto; color: red; font-weight: bold; font-size: 20px; } ul { width: 726px; margin: auto; position: relative; li { width: 100%; height: 60px; overflow: hidden; line-height: 60px; p { width: 73px; height: 60px; text-align: justify; float: left; display: inline-block; vertical-align: top; span { color: red; } } p::after { content: ""; display: inline-block; width: 100%; overflow: hidden; height: 0; } b { float: left; font-weight: 100; } input { width: 600px; float: left; height: 30px; border: 1px solid #e5e5e5; border-radius: 5px; margin-top: 15px; } } } .changPasswordP { width: 726px; margin: 30px auto; text-align: center; input { width: 88px; height: 36px; background: #009688; color: #fff; border-radius: 5px; cursor: pointer; } input:nth-of-type(1) { background: #fff; color: #000; margin-right: 25px; } } } </style> 
到此这篇登录和注册(四)重新修改密码页——清除session之sessionStorage.removeItem的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • props的几种写法——defineProps定义props、toRefs接收props、computed中get和set写法、watch深度监听immediate-true2024-11-29 20:54:07
  • route和router路由的写法——currentRoute、useRouter、useRoute、getCurrentInstance-proxy获取组件实例的用法2024-11-29 20:54:07
  • struts2入门简单案例2024-11-29 20:54:07
  • jquery实现post异步请求2024-11-29 20:54:07
  • codeIgniter手动加载config里面的配置2024-11-29 20:54:07
  • 登录和注册(二)注册成功提示页——邮箱注册和手机注册 & 定时setInterval和clearInterval & router.push & 原生请求写法http.post & public引图片2024-11-29 20:54:07
  • 登录和注册(一)注册——axios之get请求图片验证码-base64、密码由特殊字符组成、用户名密码相同重写、校验之邮箱注册和手机注册 & 定时setInterval和clearInterval2024-11-29 20:54:07
  • 会话存储sessionStorage之token、用户 & 设置-sessionStorage.setItem(‘num‘, ‘张三‘)、获取sessionStorage.getItem(‘num‘)2024-11-29 20:54:07
  • promise settimeout promise.all async/await的打印顺序2024-11-29 20:54:07
  • vu3中,时间组件el-date-picker起止日期限制——开始日期限制、结束日期限制2024-11-29 20:54:07
  • 全屏图片