@Html.PasswordFor 不要粘贴密码
我在 MVC3 的登录面板中使用此代码:
@Html.PasswordFor( m => m.Password, new { maxlength = 10 } )
我想这样做,有人无法将任何密码粘贴到 PasswordFor
中。
(仅通过打字输入密码)
我必须做什么?
I use this code in my login panel in MVC3:
@Html.PasswordFor( m => m.Password, new { maxlength = 10 } )
I want to do that, somebody cannot to PASTE any password to PasswordFor
.
(To enter password ONLY with typing)
what must i do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可能不应该这样做,因为从用户的角度来看它完全很糟糕,但如果你想让你的用户讨厌你,你可以这样做:
You probably shouldn't do as it completely sucks from user's perspective but if you want your users to hate you, you could do this:
像这样的东西:
...具有等效的事件侦听和 IE 等的默认预防功能。
jQuery:
两者都不适用于 Opera。
但无论如何,你都不应该这样做。我个人“粘贴”密码的方式比您篡改我的浏览器的默认用户体验更安全。而且你搞乱了我的方法,这可能会让我专门为你的网站选择一个不太安全的密码。或者不使用它。
Something like:
... with equivalent event listening and default prevention for IE etc.
jQuery:
Neither will work on Opera.
But then, you shouldn't be doing it in any event. My personal way of "pasting" passwords is way more secure than you tampering with my browser's default user experience. And you're messing with my method, which is likely to make me pick a less secure password specifically for your site. Or not use it.
你可以这样使用
You can use like this