asp.net - MVC5/razor - Login Password asterisks appearing on Change Password form -
on change password form have asterisks appearing in new password field. assume appearing leftover password field login form?
change password form (partial):
<div class="form-group"> @html.labelfor(m => m.password, new { @class = "col-md-3 control-label" }) <div class="col-md-9"> @html.passwordfor(m => m.password, new { @class = "form-control" }) @html.validationmessagefor(m => m.password) </div> </div> <div class="form-group"> @html.labelfor(m => m.confirmpassword, new { @class = "col-md-3 control-label" }) <div class="col-md-3"> @html.passwordfor(m => m.confirmpassword, new { @class = "form-control" }) @html.validationmessagefor(m => m.confirmpassword) </div> </div> this behavior browser-related due cookie saving password on login. i'm wondering if there anyway overcome without renaming password field?
@html.passwordfor (and of other xxxfor htmlhelpers) fill in input field whatever value model has property when page rendered. in case, model.password must have value, perhaps when fetched user database. note, if storing user's password somewhere in plain text, bad practice.
before call view in controller, clear out password property.
if doesn't work , you've confirmed password property of model empty when page loads, perhaps browser autocompletion say. can try adding autocomplete = "off" attribute input element.
Comments
Post a Comment