Say I input 'email@domain.com' and 'password' into the login fields.
The data annotations in AuthModel.cs throw back that the values aren't populated. So the data in the html form is never actually populating the model thats being thrown around.
In my awesomeness, I made a lot of hurried changes yesterday before closing the solution and didn't test the changes I had made. As a result, I don't know what I changed to break this.
If I need to post anything else let me know.
AuthController.cs
...
using FCX.Models.Auth;
...
// GET: /auth/login
[HttpPost]
public ActionResult Login(Login model)
{
if (ModelState.IsValid)
{
...
AuthModel.cs
public class AuthModel
{
public Login Login { get; set; }
public ForgotPassword ForgotPassword { get; set; }
public Register Register { get; set; }
}
...
public class Login
{
[Required
(ErrorMessageResourceName = "Login_Error_HandleRequired",
ErrorMessageResourceType = typeof(Resources.Auth))]
[Email(ErrorMessage="Invalid Email")]
public string Handle { get; set; }
[Required
(ErrorMessageResourceName = "Login_Error_PasswordRequired",
ErrorMessageResourceType = typeof(Resources.Auth))]
public string Password { get; set; }
public bool Memory { get; set; }
}
And the Index.aspx that is the login form.
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Templates/FullColumn.Master" Inherits="System.Web.Mvc.ViewPage<FCX.Models.Auth.AuthModel>" %>
...
<% Html.EnableClientValidation(); %>
<%=Html.ValidationSummary() %>
<% using (Html.BeginForm("login", "auth"))
{ %>
<div id="login-block" class="entry-block">
<h4>
Sign in</h4>
<ul>
<li>
<label for="Login_Handle">
Email Address</label><%=Html.TextBoxFor(Model => Model.Login.Handle, new { @class = "txt-input" })%></li>
<li>
<label for="Login_Password">
Password</label><%=Html.PasswordFor(Model => Model.Login.Password, new { @class = "txt-input" })%></li>
<li>
<%=Html.CheckBoxFor(Model => Model.Login.Memory, new { @class = "left-input" })%><label
for="Login_Memory" class="right-label">Keep me logged in</label></li>
<li>
<button type="submit" name="Login.Submit" value="1">
Sign in</button></li>
</ul>
</div>
<% } %>