So far, I have a page in my ASP.Net site with 2 partial views, each one with its own form, one for login, and another to register.
They are both working great, except for one thing: If my browser prompts me to remember my password when I log in, the next time I try to login, my Last Name and Password in the Register form is filled with the username/password from the Login form, such as the image below
Here is the model of the Login and Register
public class RegisterModel : IndexModel
{
[Required]
[Display(Name = "Email")]
[EmailAddress]
public string Email { get; set; }
[Required]
[Display(Name = "First Name")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Last Name")]
public string LastName { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
public class LoginModel : IndexModel
{
[Required]
[Display(Name = "Email")]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
The login partial
<% using (Html.BeginForm("Login", "Account", FormMethod.Post, new { id = "loginForm" }))
{ %>
<%: Html.AntiForgeryToken() %>
<%: Html.ValidationSummary(true) %>
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="loginEmail"><asp:Literal runat="server" Text="<%$ Resources:LOGIN_EMAIL %>"></asp:Literal></label>
<%: Html.TextBoxFor(m => m.Email, new {@class = "input-login-contacto redondo", id = "loginEmail"}) %>
</span>
</div>
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="loginPassword"><asp:Literal runat="server" Text="<%$ Resources:LOGIN_PASSWORD %>"></asp:Literal></label>
<%: Html.PasswordFor(m => m.Password, new {@class = "input-login-contacto redondo", id = "loginPassword"}) %>
</span>
</div>
<div class="12u">
<p class="remember"><%: Html.CheckBoxFor(m => m.RememberMe) %><asp:Literal runat="server" Text="<%$ Resources:LOGIN_REMEMBER %>"></asp:Literal></p>
</div>
<div class="row">
<div class="5u">
<input type="submit" name="login" value='<asp:Literal runat="server" Text="<%$ Resources:LOGIN_LOGINBTN %>"></asp:Literal>' class="submit-login-contacto fontsize-login redondo" />
</div>
<% } %>
<%: Html.Action("ExternalLoginsList", "Account", new { ReturnUrl = ViewBag.ReturnUrl }) %>
And here is the Register partial
<div class="row">
<div class="6u">
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="RegisterFirstName"><asp:Literal runat="server" Text="<%$ Resources:REGISTER_FIRSTNAME %>"></asp:Literal></label>
<%: Html.TextBoxFor(m => m.FirstName, new {id = "RegisterFirstName"}) %>
</span>
</div>
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="RegisterLastName"><asp:Literal runat="server" Text="<%$ Resources:REGISTER_LASTNAME %>"></asp:Literal></label>
<%: Html.TextBoxFor(m => m.LastName, new {id = "RegisterLastName"}) %>
</span>
</div>
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="RegisterPassword"><asp:Literal runat="server" Text="<%$ Resources:REGISTER_PASSWORD %>"></asp:Literal></label>
<%: Html.PasswordFor(m => m.Password, new {id = "RegisterPassword"}) %>
</span>
</div>
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="RegisterConfirmPassword"><asp:Literal runat="server" Text="<%$ Resources:REGISTER_CONFIRMPASS %>"></asp:Literal></label>
<%: Html.PasswordFor(m => m.ConfirmPassword, new {id = "RegisterConfirmPassword"}) %>
</span>
</div>
</div>
<div class="6u">
<div class="row">
<div class="12u">
<span class="input-with-caption fontsize-login">
<label for="RegisterEmail"><asp:Literal runat="server" Text="<%$ Resources:REGISTER_EMAIL %>"></asp:Literal></label>
<%: Html.TextBoxFor(m => m.Email, new {id = "RegisterEmail"}) %>
</span>
</div>
<div class="12u">
<%: Html.Captcha(5, "_CaptchaPartial") %>
</div>
</div>
</div>
</div>
<% } %>
I've already changed the ids and the names of the inputs, but so far, no success. This is a problem that is happening on Chrome and Firefox (at least, those are the ones that I've tried).
I'm starting to run out of ideas. Any sugestions?