Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a Log-in form that passes a model to a SurfaceController for validation.
The form works correctly and looks like this:
using (Html.BeginUmbracoForm("Login", "LoginSurface")) { @Html.EditorFor(x => Model) <input type="submit" /> }
However, I have a smaller log-in form in my other pages, which looks like this:
@using (Html.BeginUmbracoForm("Login", "LoginSurface")) { @Html.TextBoxFor(x => login.Name, new { placeholder="username" }) <br /> @Html.TextBoxFor(x => login.Password, new { placeholder = "password" }) <br /> <input type="submit" value="Sign In" class="button"> }
The design dictates that this look a little different, but I can't see that it should behave differently.
The SurfaceController that collects these requests looks like this:
[HttpPost] [ActionName("Login")] public ActionResult LoginPost(LoginModel model) { if (Membership.ValidateUser(model.Username, model.Password)) { FormsAuthentication.SetAuthCookie(model.Username, model.Remember); return RedirectToCurrentUmbracoPage(); } else { TempData["Status"] = "Invalid username or password"; return RedirectToCurrentUmbracoPage(); } }
The problem is that when my second form is used, the LoginModel is coming back to the SurfaceController with all it's fields empty.
Any idea what is going on?
In your smaller form, your field names and your x=>login don't seem to match the model. Also, for password fields you should use @Html.PasswordFor
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Log-in form works in one place, doesn't work in another in 6.1.6
I have a Log-in form that passes a model to a SurfaceController for validation.
The form works correctly and looks like this:
However, I have a smaller log-in form in my other pages, which looks like this:
The design dictates that this look a little different, but I can't see that it should behave differently.
The SurfaceController that collects these requests looks like this:
The problem is that when my second form is used, the LoginModel is coming back to the SurfaceController with all it's fields empty.
Any idea what is going on?
In your smaller form, your field names and your x=>login don't seem to match the model. Also, for password fields you should use @Html.PasswordFor
is working on a reply...