当前位置:网站首页>实际开发中,客户要求密码输入框禁止粘贴~
实际开发中,客户要求密码输入框禁止粘贴~
2022-08-04 05:26:00 【愿为浪漫渡此劫】
实际开发中的需求及解决
在做单点登录时,前端会给后端login.html静态页面,部署单点登录页面
此时,客户在使用登录页面时,突然提出新需求: 密码输入框禁止粘贴,
具体实现,如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100%;
}
button,
input {
border: none;
outline: none;
}
.loginView {
width: 100%;
height: 100%;
background: url('./public.jpg') no-repeat;
background-size: 100% 100%;
position: relative;
}
.login-container {
position: absolute;
right: 12%;
width: 10.75rem;
height: 11.5rem;
border: 1px solid #FFFFFF;
box-sizing: border-box;
border-radius: 3px;
top: 34%;
}
.login-title {
width: 7.1181rem;
text-align: center;
padding-bottom: 5px;
border-bottom: 3px solid rgba(245, 245, 245, 0.6);
margin: 1rem auto 0.6875rem;
font-size: 0.8125rem;
color: #FFFFFF;
}
.form-box {
width: 100%;
}
.item {
width: 10.75rem;
padding: 0 10px;
}
.item input {
width: 145px;
height: 25px;
background-color: transparent;
border: 0.834952px solid #FFFFFF;
box-sizing: border-box;
border-radius: 1.6699px;
padding-left: 0.75rem;
outline: none;
font-size: 0.625rem;
}
.item .form-tip {
font-size: 0.625rem;
line-height: 0.8125rem;
color: #E3E4E6;
margin-bottom: 0.146875rem;
}
.login-btn {
cursor: pointer;
width: 9.08rem;
margin: 8px auto auto;
height: 1.6344rem;
background: #4473ea;
border-radius: 2px;
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
font-size: 0.6347rem;
font-family: 'Microsoft YaHei UI';
}
</style>
</head>
<body>
<div class="loginView">
// 单点登录页面
<div class="login-container">
<div class="login-title">用户登录</div>
<form class="form-box" action="/login" method="post">
<div class="item">
<label for="username" class="form-tip">账号</label>
<input name="username" id="username" type="text" >
</div>
<div class="item">
<label for="pwd" class="form-tip">密码</label>
<input id="pwd" name="password" type="password" >
</div>
<button type="submit" class="login-btn">登录</button>
</form>
</div>
</div>
</body>
<script>
const pwd = document.querySelector('#pwd');
pwd.addEventListener("paste", function(e){
e.preventDefault()
console.log('糟糕,现在你无法复制粘贴,必须得手动编写和输入所有的内容了')
})
</script>
</html>
边栏推荐
- 解决JDBC在web工程中无法获取配置文件
- 解决安装nbextensions后使用Jupyter Notebook时出现template_paths相关错误的问题
- 字节最爱问的智力题,你会几道?
- 7. Execution of special SQL
- 8款最佳实践,保护你的 IaC 安全!
- 5个开源组件管理小技巧
- PHP实现异步执行程序
- 4.2 声明式事务概念
- DP4398:国产兼容替代CS4398立体声24位/192kHz音频解码芯片
- The cost of automated testing is high and the effect is poor, so what is the significance of automated testing?
猜你喜欢
随机推荐
webrtc中视频采集实现分析(二) 视频帧的分发
OpenRefine中的正则表达式
力扣:62.不同路径
Delphi-C端有趣的菜单操作界面设计
一个对象引用的思考
7.16 Day22---MYSQL(Dao模式封装JDBC)
嵌入式系统驱动初级【4】——字符设备驱动基础下_并发控制
8.03 Day34---BaseMapper query statement usage
【Matlab仿真】:一带电量为q的电荷以速度v运动,求运动电荷产生磁感应强度
处理List<Map<String, String>>类型
程序员也应了解的Unity粒子系统
Unity行为树AI分享
再识关联容器
【问题解决】同一机器上Flask部署TensorRT报错记录
Deploy LVS-DR cluster [experimental]
JNI基本使用
Handling List
[原创]STL容器map和unordered_map性能,创建,插入,随机访问速度对比!
4.2 声明式事务概念
力扣:746. 使用最小花费爬楼梯









