Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
VahidN committed May 12, 2023
1 parent 48bc807 commit da3b276
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ roslynator_accessibility_modifiers = explicit
roslynator_enum_has_flag_style = operator
roslynator_object_creation_type_style = implicit_when_type_is_obvious

# S2094: Remove this empty class, write its code or make it an "interface".
dotnet_diagnostic.S2094.severity = suggestion

# CA5395: Action method xyz needs to specify the HTTP request kind explicitly
dotnet_diagnostic.CA5395.severity = suggestion

Expand Down
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project>
<ItemGroup>
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.19" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.50" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.5.22" />
<PackageVersion Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="AsyncFixer" Version="1.6.0" />
<PackageVersion Include="Asyncify" Version="0.9.7" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="8.53.0.62665" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.0.0.68202" />
<PackageVersion Include="SecurityCodeScan.VS2019" Version="5.6.7" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.2.0" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.3.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3" />
<PackageVersion Include="DNTBreadCrumb.Core" Version="1.9.3" />
<PackageVersion Include="DNTCaptcha.Core" Version="4.4.2" />
<PackageVersion Include="DNTCommon.Web.Core" Version="3.5.0" />
<PackageVersion Include="DNTCaptcha.Core" Version="4.6.0" />
<PackageVersion Include="DNTCommon.Web.Core" Version="3.5.2" />
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="DNTPersianUtils.Core" Version="5.4.9" />
<PackageVersion Include="DNTPersianUtils.Core" Version="5.6.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.3" />
Expand All @@ -35,7 +35,7 @@
<PackageVersion Include="MSTest.TestFramework" Version="3.0.2" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="7.0.3" />
<PackageVersion Include="cloudscribe.Web.Pagination" Version="6.0.0" />
<PackageVersion Include="LigerShark.WebOptimizer.Core" Version="3.0.378" />
<PackageVersion Include="LigerShark.WebOptimizer.Core" Version="3.0.384" />
<PackageVersion Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Language = DNTCaptcha.Core.Language;

namespace ASPNETCoreIdentitySample.Areas.Identity.Controllers;

[Area(AreaConstants.IdentityArea), AllowAnonymous,
BreadCrumb(Title = "بازیابی کلمه‌ی عبور", UseDefaultRouteUrl = true, Order = 0)]
[Area(AreaConstants.IdentityArea)]
[AllowAnonymous]
[BreadCrumb(Title = "بازیابی کلمه‌ی عبور", UseDefaultRouteUrl = true, Order = 0)]
public class ForgotPasswordController : Controller
{
private readonly IEmailSender _emailSender;
Expand All @@ -38,19 +38,14 @@ public ForgotPasswordController(
}

[BreadCrumb(Title = "تائید کلمه‌ی عبور فراموش شده", Order = 1)]
public IActionResult ForgotPasswordConfirmation()
{
return View();
}
public IActionResult ForgotPasswordConfirmation() => View();

[BreadCrumb(Title = "ایندکس", Order = 1)]
public IActionResult Index()
{
return View();
}
public IActionResult Index() => View();

[HttpPost, ValidateAntiForgeryToken, ValidateDNTCaptcha(CaptchaGeneratorLanguage = Language.Persian,
CaptchaGeneratorDisplayMode = DisplayMode.SumOfTwoNumbers)]
[HttpPost]
[ValidateAntiForgeryToken]
[ValidateDNTCaptcha]
public async Task<IActionResult> Index(ForgotPasswordViewModel model)
{
if (model is null)
Expand All @@ -68,16 +63,16 @@ public async Task<IActionResult> Index(ForgotPasswordViewModel model)

var code = await _userManager.GeneratePasswordResetTokenAsync(user);
await _emailSender.SendEmailAsync(
model.Email,
"بازیابی کلمه‌ی عبور",
"~/Areas/Identity/Views/EmailTemplates/_PasswordReset.cshtml",
new PasswordResetViewModel
{
UserId = user.Id,
Token = code,
EmailSignature = _siteOptions.Value.Smtp.FromName,
MessageDateTime = DateTime.UtcNow.ToLongPersianDateTimeString()
})
model.Email,
"بازیابی کلمه‌ی عبور",
"~/Areas/Identity/Views/EmailTemplates/_PasswordReset.cshtml",
new PasswordResetViewModel
{
UserId = user.Id,
Token = code,
EmailSignature = _siteOptions.Value.Smtp.FromName,
MessageDateTime = DateTime.UtcNow.ToLongPersianDateTimeString(),
})
;

return View("ForgotPasswordConfirmation");
Expand All @@ -89,7 +84,10 @@ await _emailSender.SendEmailAsync(
/// <summary>
/// For [Remote] validation
/// </summary>
[AjaxOnly, HttpPost, ValidateAntiForgeryToken, ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
[AjaxOnly]
[HttpPost]
[ValidateAntiForgeryToken]
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
public async Task<IActionResult> ValidatePassword(string password, string email)
{
var user = await _userManager.FindByEmailAsync(email);
Expand All @@ -99,17 +97,15 @@ public async Task<IActionResult> ValidatePassword(string password, string email)
}

var result = await _passwordValidator.ValidateAsync(
(UserManager<User>)_userManager, user, password);
(UserManager<User>)_userManager, user, password);
return Json(result.Succeeded ? "true" : result.DumpErrors(true));
}

[BreadCrumb(Title = "تغییر کلمه‌ی عبور", Order = 1)]
public IActionResult ResetPassword(string code = null)
{
return code == null ? View("Error") : View();
}
public IActionResult ResetPassword(string code = null) => code == null ? View("Error") : View();

[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
{
if (model is null)
Expand Down Expand Up @@ -144,8 +140,5 @@ public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
}

[BreadCrumb(Title = "تائیدیه تغییر کلمه‌ی عبور", Order = 1)]
public IActionResult ResetPasswordConfirmation()
{
return View();
}
public IActionResult ResetPasswordConfirmation() => View();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

namespace ASPNETCoreIdentitySample.Areas.Identity.Controllers;

[Area(AreaConstants.IdentityArea), AllowAnonymous,
BreadCrumb(Title = "ورود به سیستم", UseDefaultRouteUrl = true, Order = 0)]
[Area(AreaConstants.IdentityArea)]
[AllowAnonymous]
[BreadCrumb(Title = "ورود به سیستم", UseDefaultRouteUrl = true, Order = 0)]
public class LoginController : Controller
{
private readonly IApplicationSignInManager _signInManager;
Expand All @@ -28,15 +29,17 @@ public LoginController(
_siteOptions = siteOptions ?? throw new ArgumentNullException(nameof(siteOptions));
}

[BreadCrumb(Title = "ایندکس", Order = 1), NoBrowserCache]
[BreadCrumb(Title = "ایندکس", Order = 1)]
[NoBrowserCache]
public IActionResult Index(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}

[HttpPost, ValidateAntiForgeryToken, ValidateDNTCaptcha(CaptchaGeneratorLanguage = Language.Persian,
CaptchaGeneratorDisplayMode = DisplayMode.SumOfTwoNumbers)]
[HttpPost]
[ValidateAntiForgeryToken]
[ValidateDNTCaptcha]
public async Task<IActionResult> Index(LoginViewModel model, string returnUrl = null)
{
if (model is null)
Expand Down Expand Up @@ -68,10 +71,10 @@ public async Task<IActionResult> Index(LoginViewModel model, string returnUrl =
}

var result = await _signInManager.PasswordSignInAsync(
model.Username,
model.Password,
model.RememberMe,
true);
model.Username,
model.Password,
model.RememberMe,
true);
if (result.Succeeded)
{
if (Url.IsLocalUrl(returnUrl))
Expand All @@ -85,9 +88,9 @@ public async Task<IActionResult> Index(LoginViewModel model, string returnUrl =
if (result.RequiresTwoFactor)
{
return RedirectToAction(
nameof(TwoFactorController.SendCode),
"TwoFactor",
new { ReturnUrl = returnUrl, model.RememberMe });
nameof(TwoFactorController.SendCode),
"TwoFactor",
new { ReturnUrl = returnUrl, model.RememberMe });
}

if (result.IsLockedOut)
Expand All @@ -112,8 +115,8 @@ public async Task<IActionResult> Index(LoginViewModel model, string returnUrl =
public async Task<IActionResult> LogOff()
{
var user = User.Identity is { IsAuthenticated: true }
? await _userManager.FindByNameAsync(User.Identity.Name)
: null;
? await _userManager.FindByNameAsync(User.Identity.Name)
: null;
await _signInManager.SignOutAsync();
if (user != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ public IActionResult Index()
return View();
}

[HttpPost, ValidateAntiForgeryToken, ValidateDNTCaptcha(CaptchaGeneratorLanguage = Language.Persian,
CaptchaGeneratorDisplayMode = DisplayMode.SumOfTwoNumbers)]
[HttpPost, ValidateAntiForgeryToken, ValidateDNTCaptcha]
public async Task<IActionResult> Index(RegisterViewModel model)
{
if (model is null)
Expand Down

0 comments on commit da3b276

Please sign in to comment.