asp.net mvc - MVC RememberMe Validation Glitch -
in mvc project validator unintentionally requires rememberme checkbox checked upon logging in. on ie8, not allow user login unless tick remember me box. other browsers fine including ie7.
<input id="rememberme" type="checkbox" value="true" name="rememberme" data-val-required="the remember me? field required." data-val="false">
i tried change property in entity framework nullable bool? produces error:
the best overloaded method match 'webmatrix.webdata.websecurity.login(string, string, bool)' has invalid argument
so, doesn't able change fix issue. have tried on writing property jquery gets changed back. random , i'm suprised got on looked out of box technology. appreciated.
here login model:
public class loginmodel { [emailaddressattribute] [required] [stringlength(80)] [display(name = "email address")] public string username { get; set; } [required] [datatype(datatype.password)] [display(name = "password")] public string password { get; set; } [display(name = "remember me?")] public bool rememberme { get; set; } }
and controller login, can see out of box mvc stuff:
[httppost] [allowanonymous] [validateantiforgerytoken] public actionresult login(loginmodel model, string returnurl) { if (modelstate.isvalid && websecurity.login(model.username, model.password, persistcookie: model.rememberme)) { return redirecttolocal(returnurl); } // if got far, failed, redisplay form modelstate.addmodelerror("", "the user name or password provided incorrect."); return view(model); }
and here view:
@html.validationsummary(true) <ol class="form"> <li> @html.labelfor(m => m.username) @html.textboxfor(m => m.username, new { id="txusername" }) @html.validationmessagefor(m => m.username) </li> <li> @html.labelfor(m => m.password) @html.passwordfor(m => m.password) @html.validationmessagefor(m => m.password) </li> <li> @html.labelfor(m => m.rememberme, new { @class = "checkbox" }) @html.checkboxfor(m => m.rememberme) </li> <li class="form-buttons"> <input type="submit" value="log in" /> @html.actionlink("forgot password", "forgotpassword", "account") </li> </ol>
after doing research, said caused ie7 & ie8 compatibility mode in internet explorer 10 only.
it cause other problems unobtrusive jquery validation running under same conditions.
Comments
Post a Comment