我很努力登錄時出現登錄對話框。我需要發生的是,當用戶使用內置的MVC3身份驗證控件登錄時,我需要它彈出一個對話框,吐出一些條款和協議,並說「如果您接受,則表示您同意上述內容」。我目前有,但是當我取消時,網站仍然會登錄。這裏是我的代碼:'你接受條款和條件嗎?'在登錄表單身份驗證MVC3
<fieldset>
<legend>Login</legend>
<div class="editor-label">
@Html.LabelFor(model => model.userName)
</div>
<div class="focus">
<div class="editor-field">
@Html.EditorFor(model => model.userName)
</div>
</div>
<div class="editor-label">
@Html.LabelFor(model => model.passWord)
</div>
<div class="editor-field">
@Html.PasswordFor(model => model.passWord)
</div>
<p>
<input type="submit" value="Login" name="btnLogin" id="btnLogin" />
</p>
@Html.ValidationSummary(true)
</fieldset>
和JavaScript,我有:
<script type="text/javascript">
$(function() {
$("#btnLogin").click(function() {
var answer = confirm("Unauthorized access or use of the web content is prohibited.\n" + "By clicking 'OK', you have agreed to the above conditions");
if (answer) {
}
else {
$(this).dialog("close");
}
});
});
</script>
我將如何得到它僅僅取消HttpPost上登錄時,用戶點擊該對話框上取消,並繼續登錄如果他們打好了?
非常感謝!
只是如此,你知道,有人仍然可以通過登錄而不檢查,因爲你你只能在客戶端檢查這個值。你應該驗證所有的輸入,不管它來自客戶端和服務器兩者 –