Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc1'
Browse files Browse the repository at this point in the history
  • Loading branch information
albx committed Dec 22, 2017
2 parents 3badf49 + 0eef19a commit ad9e497
Show file tree
Hide file tree
Showing 29 changed files with 329 additions and 141 deletions.
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# How to contribute
One of the goal of Wilcommerce is growing through the contributions of the community.<br/>
If you have any issue, features or patches to submit, please follow this few guidelines.

## Getting Started
- Make sure you have a [GitHub account](https://github.com/join)
- Check if your feature or bug is already in our issues.<br/>
If not [create a new issue](https://github.com/wilcommerce/Wilcommerce.Auth/issues) and describe it clearly.
- If it's a bug include also the steps to reproduce it and tell us the Wilcommerce version you have encountered it on.
- Fork the repository on GitHub.

## Making Changes
- Create a new feature branch in your fork starting from the develop branch.
- Make commits of logical units.
- Check for unnecessary whitespace with ```git diff --check``` before committing.
- Make sure your commit messages are in the proper format.
- Write unit tests adding your test class to the **Wilcommerce.Auth.Test** project.
- Run **all** the tests to avoid breaking changes.

## Submitting Changes
- Push your changes to your feature branch in your fork.
- [Submit a pull request](https://github.com/wilcommerce/Wilcommerce.Auth/pulls)

# Additional Resources
- [GitHub Documentation](https://help.github.com/)
- [GitHub Flow](https://help.github.com/articles/github-flow/)
- [Working with forks](https://help.github.com/articles/working-with-forks/)
- [Submit pull request](https://help.github.com/articles/proposing-changes-to-your-work-with-pull-requests/)
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ The **Services** namespace contains a set of components which gives a simple acc
This namespace contains the interface which defines the persistence of the components.

## Events
In the **Events** namespace are defined all the events that could happen after an action made.
In the **Events** namespace are defined all the events that could happen after an action made.

# Contributing
If you want to contribute to Wilcommerce please, check the [CONTRIBUTING](CONTRIBUTING.md) file.
2 changes: 1 addition & 1 deletion Wilcommerce.Auth.Test/Models/UserTokenTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void SetAsExpired_Should_Set_ExpirationDate_To_Today()
var userToken = UserToken.Registration(user, token, expirationDate);
userToken.SetAsExpired();

Assert.Equal(true, userToken.IsExpired);
Assert.True(userToken.IsExpired);
Assert.Equal(DateTime.Now.ToString("yyyy-MM-dd"), userToken.ExpirationDate.ToString("yyyy-MM-dd"));
}
}
Expand Down
25 changes: 25 additions & 0 deletions Wilcommerce.Auth.Test/Wilcommerce.Auth.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Wilcommerce.Auth.Test</AssemblyName>
<PackageId>Wilcommerce.Auth.Test</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\src\Wilcommerce.Auth\Wilcommerce.Auth.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
</ItemGroup>

</Project>
22 changes: 0 additions & 22 deletions Wilcommerce.Auth.Test/Wilcommerce.Auth.Test.xproj

This file was deleted.

26 changes: 0 additions & 26 deletions Wilcommerce.Auth.Test/project.json

This file was deleted.

17 changes: 11 additions & 6 deletions Wilcommerce.Auth.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D3477DCE-8BF1-426D-988D-E635FA87D1E6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{04E04DDE-9D8E-4FF2-8E33-A77BDB05407F}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
.gitignore = .gitignore
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Wilcommerce.Auth", "src\Wilcommerce.Auth\Wilcommerce.Auth.xproj", "{44A956D2-E32F-49D9-A4D1-3380C0F6DCF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{D9B968BF-5C00-485C-90F8-105B2B70C349}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Wilcommerce.Auth.Test", "Wilcommerce.Auth.Test\Wilcommerce.Auth.Test.xproj", "{0A3668D7-C428-442A-9254-3DD5683ECB31}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wilcommerce.Auth", "src\Wilcommerce.Auth\Wilcommerce.Auth.csproj", "{44A956D2-E32F-49D9-A4D1-3380C0F6DCF7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wilcommerce.Auth.Test", "Wilcommerce.Auth.Test\Wilcommerce.Auth.Test.csproj", "{0A3668D7-C428-442A-9254-3DD5683ECB31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -39,4 +41,7 @@ Global
{44A956D2-E32F-49D9-A4D1-3380C0F6DCF7} = {D3477DCE-8BF1-426D-988D-E635FA87D1E6}
{0A3668D7-C428-442A-9254-3DD5683ECB31} = {D9B968BF-5C00-485C-90F8-105B2B70C349}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A16E1AA2-E3B8-45F0-853E-0C884A118FCC}
EndGlobalSection
EndGlobal
6 changes: 0 additions & 6 deletions global.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Wilcommerce.Auth.Commands.Handlers.Interfaces
{
/// <summary>
/// Performs the password recovery action
/// </summary>
public interface IRecoverPasswordCommandHandler : ICommandHandlerAsync<RecoverPasswordCommand>
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Wilcommerce.Auth.Commands.Handlers.Interfaces
{
/// <summary>
/// Performs the validation for the password recovery request
/// </summary>
public interface IValidatePasswordRecoveryCommandHandler : ICommandHandlerAsync<ValidatePasswordRecoveryCommand>
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,37 @@

namespace Wilcommerce.Auth.Commands.Handlers
{
/// <summary>
/// Implementation of <see cref="Interfaces.IRecoverPasswordCommandHandler"/>
/// </summary>
public class RecoverPasswordCommandHandler : Interfaces.IRecoverPasswordCommandHandler
{
/// <summary>
/// Get the event bus
/// </summary>
public Core.Infrastructure.IEventBus EventBus { get; }

/// <summary>
/// Get the authentication repository
/// </summary>
public IRepository Repository { get; }

/// <summary>
/// Construct the command handler
/// </summary>
/// <param name="repository">The repository instance</param>
/// <param name="eventBus">The event bus instance</param>
public RecoverPasswordCommandHandler(IRepository repository, Core.Infrastructure.IEventBus eventBus)
{
Repository = repository;
EventBus = eventBus;
}

/// <summary>
/// Recover the password for the user
/// </summary>
/// <param name="command">The command to execute</param>
/// <returns></returns>
public async Task Handle(RecoverPasswordCommand command)
{
try
Expand All @@ -27,7 +46,7 @@ public async Task Handle(RecoverPasswordCommand command)
Repository.Add(userToken);
await Repository.SaveChangesAsync();

var @event = new PasswordRecoveryRequestedEvent(userToken.UserId, userToken.User.Email, userToken.Id, userToken.Token, userToken.ExpirationDate);
var @event = new PasswordRecoveryRequestedEvent(userToken.UserId, command.UserInfo.Email, userToken.Id, userToken.Token, userToken.ExpirationDate);
EventBus.RaiseEvent(@event);
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,44 @@

namespace Wilcommerce.Auth.Commands.Handlers
{
/// <summary>
/// Implementation of <see cref="Interfaces.IValidatePasswordRecoveryCommandHandler"/>
/// </summary>
public class ValidatePasswordRecoveryCommandHandler : Interfaces.IValidatePasswordRecoveryCommandHandler
{
/// <summary>
/// Get the authentication database
/// </summary>
public IAuthDatabase Database { get; }

/// <summary>
/// Get the authentication repository
/// </summary>
public IRepository Repository { get; }

/// <summary>
/// Get the event bus
/// </summary>
public Core.Infrastructure.IEventBus EventBus { get; }

/// <summary>
/// Construct the command handler
/// </summary>
/// <param name="database">The database instance</param>
/// <param name="repository">The repository instance</param>
/// <param name="eventBus">The event bus instance</param>
public ValidatePasswordRecoveryCommandHandler(IAuthDatabase database, IRepository repository, Core.Infrastructure.IEventBus eventBus)
{
Database = database;
Repository = repository;
EventBus = eventBus;
}

/// <summary>
/// Validate the password recovery request
/// </summary>
/// <param name="command">The command to execute</param>
/// <returns></returns>
public async Task Handle(ValidatePasswordRecoveryCommand command)
{
try
Expand Down
14 changes: 14 additions & 0 deletions src/Wilcommerce.Auth/Commands/RecoverPasswordCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@

namespace Wilcommerce.Auth.Commands
{
/// <summary>
/// Recover the user password
/// </summary>
public class RecoverPasswordCommand : ICommand
{
/// <summary>
/// Get the user information
/// </summary>
public User UserInfo { get; }

/// <summary>
/// Get the recovery token
/// </summary>
public string Token { get; }

/// <summary>
/// Construct the command
/// </summary>
/// <param name="user">The user information</param>
/// <param name="token">The recovery token</param>
public RecoverPasswordCommand(User user, string token)
{
UserInfo = user;
Expand Down
10 changes: 10 additions & 0 deletions src/Wilcommerce.Auth/Commands/ValidatePasswordRecoveryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

namespace Wilcommerce.Auth.Commands
{
/// <summary>
/// Validate the password recovery request
/// </summary>
public class ValidatePasswordRecoveryCommand : ICommand
{
/// <summary>
/// Get the recovery token
/// </summary>
public string Token { get; }

/// <summary>
/// Construct the command
/// </summary>
/// <param name="token">The recovery token</param>
public ValidatePasswordRecoveryCommand(string token)
{
Token = token;
Expand Down
Loading

0 comments on commit ad9e497

Please sign in to comment.