Add registration workflow

Update unobtrusive Validation
This commit is contained in:
2020-01-10 14:52:11 -05:00
parent e0464cb77c
commit 8452a9cce0
34 changed files with 235 additions and 898 deletions
@@ -7,28 +7,22 @@
var loginModel = new LoginModel { RedirectUrl = "/leaf-data/manage-queue/" };
}
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-lg-4 card card-body bg-light">
@using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))
{
<fieldset>
@Html.ValidationSummary("loginModel", true)
<div class="form-group">
@Html.LabelFor(m => loginModel.Username)
@Html.TextBoxFor(m => loginModel.Username, new {@class = "form-control" })
@Html.ValidationMessageFor(m => loginModel.Username)
</div>
<div class="form-group">
@Html.LabelFor(m => loginModel.Password)
@Html.PasswordFor(m => loginModel.Password, new {@class = "form-control" })
@Html.ValidationMessageFor(m => loginModel.Password)
</div>
<div class="container mt-3">
<div class="row justify-content-center">
<div class="col-lg-4 card card-body bg-light">
@using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))
{
@Html.EditorFor(m => loginModel.Username)
@Html.EditorFor(m => loginModel.Password, "Password")
<button class="btn btn-primary pull-right">Login</button>
@Html.HiddenFor(m => loginModel.RedirectUrl)
</fieldset>
}
@Html.ValidationSummary("loginModel", true)
<button class="btn btn-primary pull-right">Login</button>
@Html.HiddenFor(m => loginModel.RedirectUrl)
}
</div>
</div>
<div class="row justify-content-center mt-lg-3">
<p>Don't have an account? <a href="/membership/register">Register here</a> </p>
</div>
</div>
</div>
@@ -12,25 +12,23 @@
Html.EnableClientValidation();
Html.RequiresJs("~/scripts/jquery.validate.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.bootstrap.js", 2);
Html.RequiresJs("~/scripts/Register.js");
var user = Membership.GetUser();
if (user != null)
{
TempData["StatusMessage"] = "You are already logged in, " + user.UserName;
TempData["StatusMessage-Type"] = "alert-danger";
// todo: redirect
}
}
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-lg-6 card card-body bg-light">
@if (success)
@if (success || (!user?.IsApproved ?? false))
{
<p>Registration succeeded.</p>
<p><span class="fa fa-check text-primary"></span> Registration succeeded. Please check your email to verify your account.</p>
}
else if (user != null)
{
<p>No need to register - you are already logged withe email @user.Email</p>
}
else
{
@@ -39,30 +37,33 @@ else
null,
new {id="register-member"}))
{
<div class="form-group">
@Html.ValidationSummary("registerModel", true)
@Html.ValidationSummary(true)
@Html.EditorFor(m => registerModel.Name)
@Html.EditorFor(m => registerModel.Email, new { type = "email"})
@Html.EditorFor(m => registerModel.Password, "Password")
@*<div class="form-group">
@Html.LabelFor(m => registerModel.Name)
@Html.TextBoxFor(m => registerModel.Name, new { @class = "form-control" })
@Html.ValidationMessageFor(m => registerModel.Name)
@Html.ValidationMessageFor(m => registerModel.Name, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@Html.LabelFor(m => registerModel.Email)
@Html.TextBoxFor(m => registerModel.Email, new { @class = "form-control" })
@Html.ValidationMessageFor(m => registerModel.Email)
@Html.ValidationMessageFor(m => registerModel.Email, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@Html.LabelFor(m => registerModel.Password)
@Html.PasswordFor(m => registerModel.Password, new { @class = "form-control" })
@Html.ValidationMessageFor(m => registerModel.Password)
</div>
<div class="form-group">
@Html.ValidationMessageFor(m => registerModel.Password, "", new { @class = "text-danger" })
</div>*@
<div class="form-group verifyPassword">
@Html.Label("VerifyPassword")
@Html.Password("VerifyPassword", null, new { @class = "form-control" })
@Html.ValidationMessage("VerifyPassword")
@Html.ValidationMessage("VerifyPassword", "", new { @class = "text-danger" })
</div>
if (registerModel.MemberProperties != null)
@*if (registerModel.MemberProperties != null)
{
for (var i = 0; i < registerModel.MemberProperties.Count; i++)
{
@@ -72,7 +73,7 @@ else
@Html.HiddenFor(m => registerModel.MemberProperties[i].Alias)
</div>
}
}
}*@
@Html.HiddenFor(m => registerModel.MemberTypeAlias)
@Html.HiddenFor(m => registerModel.RedirectUrl)