-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert FogotPassword views to shapes
- Loading branch information
1 parent
70cc055
commit 9a6ad96
Showing
17 changed files
with
218 additions
and
69 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...ardCore.Modules/OrchardCore.ReCaptcha/Drivers/ReCaptchaForgotPasswordFormDisplayDriver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.DisplayManagement.Handlers; | ||
using OrchardCore.DisplayManagement.Views; | ||
using OrchardCore.ReCaptcha.Configuration; | ||
using OrchardCore.Settings; | ||
using OrchardCore.Users.Models; | ||
|
||
namespace OrchardCore.ReCaptcha.Drivers; | ||
|
||
public class ReCaptchaForgotPasswordFormDisplayDriver : DisplayDriver<ForgotPasswordForm> | ||
{ | ||
private readonly ISiteService _siteService; | ||
|
||
public ReCaptchaForgotPasswordFormDisplayDriver(ISiteService siteService) | ||
{ | ||
_siteService = siteService; | ||
} | ||
|
||
public override async Task<IDisplayResult> EditAsync(ForgotPasswordForm model, BuildEditorContext context) | ||
{ | ||
var _reCaptchaSettings = (await _siteService.GetSiteSettingsAsync()).As<ReCaptchaSettings>(); | ||
|
||
if (!_reCaptchaSettings.IsValid()) | ||
{ | ||
return null; | ||
} | ||
|
||
return View("FormReCaptcha_Edit", model).Location("Content:after"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/OrchardCore.Modules/OrchardCore.Users/Drivers/ForgotPasswordFormDisplayDriver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.DisplayManagement.Handlers; | ||
using OrchardCore.DisplayManagement.ModelBinding; | ||
using OrchardCore.DisplayManagement.Views; | ||
using OrchardCore.Users.Models; | ||
using OrchardCore.Users.ViewModels; | ||
|
||
namespace OrchardCore.Users.Drivers; | ||
|
||
public class ForgotPasswordFormDisplayDriver : DisplayDriver<ForgotPasswordForm> | ||
{ | ||
public override IDisplayResult Edit(ForgotPasswordForm model) | ||
{ | ||
return Initialize<ForgotPasswordViewModel>("ForgotPasswordFormIdentifier_Edit", vm => | ||
{ | ||
vm.Identifier = model.Identifier; | ||
}).Location("Content"); | ||
} | ||
|
||
public override async Task<IDisplayResult> UpdateAsync(ForgotPasswordForm model, IUpdateModel updater) | ||
{ | ||
var viewModel = new ForgotPasswordViewModel(); | ||
|
||
await updater.TryUpdateModelAsync(viewModel, Prefix); | ||
|
||
model.Identifier = viewModel.Identifier; | ||
|
||
return Edit(model); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
src/OrchardCore.Modules/OrchardCore.Users/ViewModels/ForgotPasswordViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace OrchardCore.Users.ViewModels | ||
{ | ||
public class ForgotPasswordViewModel | ||
{ | ||
[Required(ErrorMessage = "Email is required.")] | ||
[Obsolete("Email property is not longer used and will be removed in future releases. Instead use Identifier.")] | ||
[Email.EmailAddress(ErrorMessage = "Invalid Email.")] | ||
public string Email { get; set; } | ||
|
||
[Required(ErrorMessage = "Username or Email is required.")] | ||
public string Identifier { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/OrchardCore.Modules/OrchardCore.Users/Views/ForgotPasswordForm.Edit.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
<div class="row"> | ||
<div class="col-md-offset-4 col-md-8"> | ||
<h2>@T["Forgot password?"]</h2> | ||
<hr /> | ||
|
||
<form asp-action="ForgotPassword" method="post" class="no-multisubmit"> | ||
|
||
<div asp-validation-summary="All"></div> | ||
|
||
@if (Model.Content != null) | ||
{ | ||
@await DisplayAsync(Model.Content) | ||
} | ||
|
||
<div class="mb-3"> | ||
<button type="submit" class="btn btn-primary">@T["Submit"]</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
src/OrchardCore.Modules/OrchardCore.Users/Views/ForgotPasswordFormIdentifier.Edit.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@model ForgotPasswordViewModel | ||
|
||
<div class="mb-3"> | ||
<label asp-for="Identifier" class="form-label">@T["Username or Email"]</label> | ||
<input asp-for="Identifier" class="form-control" /> | ||
</div> |
25 changes: 1 addition & 24 deletions
25
src/OrchardCore.Modules/OrchardCore.Users/Views/ResetPassword/ForgotPassword.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
@model OrchardCore.Users.ViewModels.ForgotPasswordViewModel | ||
|
||
@{ | ||
ViewLayout = "Layout__Login"; | ||
} | ||
|
||
<h2>@T["Forgot password?"]</h2> | ||
<h4>@T["Please check your email to reset your password."]</h4> | ||
<hr /> | ||
<div class="row"> | ||
<div class="col-md-8"> | ||
<form asp-controller="ResetPassword" asp-action="ForgotPassword" method="post" class="form-horizontal no-multisubmit"> | ||
<div asp-validation-summary="All"></div> | ||
<div class="mb-3"> | ||
<label asp-for="Email" class="col-md-4 form-label">@T["Email"]</label> | ||
<div class="col-md-9"> | ||
<input asp-for="Email" class="form-control" /> | ||
</div> | ||
</div> | ||
@await RenderSectionAsync("AfterForgotPassword", required: false) | ||
<div class="mb-3"> | ||
<div class="col-md-offset-4 col-md-8"> | ||
<button type="submit" class="btn btn-primary">@T["Submit"]</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
@await DisplayAsync(Model) |
Oops, something went wrong.