-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
722 additions
and
349 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,3 +263,4 @@ __pycache__/ | |
/VBaseProject.Test/coverage.json | ||
/.editorconfig | ||
/.sonarqube | ||
/tests/Orion.Test/coverage |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
11 changes: 11 additions & 0 deletions
11
src/Orion.Application.Core/Commands/UserChangePassword/UserChangePasswordRequest.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,11 @@ | ||
using MediatR; | ||
|
||
namespace Orion.Application.Core.Commands.UserChangePassword | ||
{ | ||
public class UserChangePasswordRequest : IRequest<Unit> | ||
{ | ||
public string CurrentPassword { get; set; } | ||
public string NewPassword { get; set; } | ||
public string NewPasswordConfirm { get; set; } | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Orion.Application.Core/Commands/UserChangePassword/UserUpdatePasswordRequestHandler.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 MediatR; | ||
using Orion.Application.Core.Notifications.UserPasswordChanged; | ||
using Orion.Domain.Core.Authentication; | ||
using Orion.Domain.Core.Services.Interfaces; | ||
|
||
namespace Orion.Application.Core.Commands.UserChangePassword | ||
{ | ||
public class UserUpdatePasswordRequestHandler : IRequestHandler<UserChangePasswordRequest, Unit> | ||
{ | ||
private readonly IUserService _userService; | ||
private readonly ICurrentUser _currentUser; | ||
private readonly IMediator _mediator; | ||
|
||
public UserUpdatePasswordRequestHandler(IUserService userService, ICurrentUser currentUser, IMediator mediator) | ||
{ | ||
_userService = userService; | ||
_currentUser = currentUser; | ||
_mediator = mediator; | ||
} | ||
|
||
public async Task<Unit> Handle(UserChangePasswordRequest request, CancellationToken cancellationToken) | ||
{ | ||
await _userService.ChangePasswordAsync(_currentUser.Id, request.CurrentPassword, request.NewPassword); | ||
|
||
await _mediator.Publish(new UserPasswordChangedNotification(), cancellationToken); | ||
|
||
return Unit.Value; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Orion.Application.Core/Commands/UserChangePassword/UserUpdateRequestValidator.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,25 @@ | ||
using FluentValidation; | ||
using Microsoft.Extensions.Localization; | ||
using Orion.Croscutting.Resources; | ||
using static Orion.Croscutting.Resources.Messages.MessagesKeys; | ||
|
||
namespace Orion.Application.Core.Commands.UserChangePassword; | ||
|
||
public class UserChangePasswordRequestValidator : AbstractValidator<UserChangePasswordRequest> | ||
{ | ||
public UserChangePasswordRequestValidator(IStringLocalizer<OrionResources> stringLocalizer) | ||
{ | ||
|
||
RuleFor(c => c.CurrentPassword) | ||
.NotEmpty().WithMessage(stringLocalizer[UserMessages.EmptyPasword]); | ||
|
||
RuleFor(c => c.NewPassword) | ||
.NotEmpty().WithMessage(stringLocalizer[UserMessages.EmptyNewPasword]); | ||
|
||
RuleFor(c => c.NewPasswordConfirm) | ||
.NotEmpty().WithMessage(stringLocalizer[UserMessages.EmptyNewPaswordConfirmation]); | ||
|
||
RuleFor(x => x.NewPassword).Equal(x => x.NewPasswordConfirm) | ||
.WithMessage(stringLocalizer[UserMessages.PaswordAndConfirmationDifferent]); | ||
} | ||
} |
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
20 changes: 0 additions & 20 deletions
20
src/Orion.Application.Core/Commands/UserDelete/UserDeleteRequestValidator.cs
This file was deleted.
Oops, something went wrong.
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
9 changes: 9 additions & 0 deletions
9
...ion.Application.Core/Notifications/UserPasswordChanged/UserPasswordChangedNotification.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,9 @@ | ||
using MediatR; | ||
|
||
namespace Orion.Application.Core.Notifications.UserPasswordChanged | ||
{ | ||
public class UserPasswordChangedNotification : INotification | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.