Skip to content

Commit de95241

Browse files
committed
merge
2 parents 6e0491f + 93d3da3 commit de95241

File tree

120 files changed

+1742
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1742
-828
lines changed

src/DockerCompose/Windows/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ version: "3.7"
33
services:
44

55
coderr-server-web:
6-
image: "coderrio/win_coderrserverweb:latest"
7-
container_name: coderr-server-web
8-
hostname: coderr-server-web
6+
image: "coderrio/communityserver-win:latest"
7+
container_name: coderr-communityserver
8+
hostname: coderr-communityserver
99
ports:
1010
- "2500:80"
1111

src/Server/BuildAndPushWinImage.bat

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Server/BuildFrontend.bat

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Server/Coderr.Server.Abstractions/Config/ConfigurationCategoryExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public static void AssignProperties(this IConfigurationSection section, IDiction
2323
foreach (var kvp in settings)
2424
{
2525
var property = type.GetProperty(kvp.Key);
26+
if (property == null)
27+
continue;
28+
2629
var propertyType = property.PropertyType;
2730
if (propertyType == typeof(Uri))
2831
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Coderr.Server.Abstractions
6+
{
7+
/// <summary>
8+
/// Wraps either the configuration file or the Docker environment variables.
9+
/// </summary>
10+
public class HostConfig
11+
{
12+
public static HostConfig Instance = new HostConfig();
13+
14+
public bool IsRunningInDocker { get; set; }
15+
public string ConnectionString { get; set; }
16+
public bool IsConfigured { get; set; }
17+
public string ConfigurationPassword { get; set; }
18+
19+
}
20+
}

src/Server/Coderr.Server.App.Tests/Core/Applications/Commands/InviteUserHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private ClaimsPrincipal CreateUserPrincipal()
163163
var claims = new List<Claim>
164164
{
165165
};
166-
var identity = new ClaimsIdentity(claims);
166+
var identity = new ClaimsIdentity(claims, AuthenticationTypes.Default);
167167
return new ClaimsPrincipal(identity);
168168
}
169169
}

src/Server/Coderr.Server.App.Tests/PrincipalHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Security.Claims;
3+
using Coderr.Server.Infrastructure.Security;
34

45
namespace Coderr.Server.App.Tests
56
{
@@ -12,7 +13,7 @@ public static ClaimsPrincipal Create(int userId, string userName)
1213
new Claim(ClaimTypes.Name, userName),
1314
new Claim(ClaimTypes.NameIdentifier, userId.ToString(), ClaimValueTypes.Integer32),
1415
};
15-
var identity = new ClaimsIdentity(claims);
16+
var identity = new ClaimsIdentity(claims, AuthenticationTypes.Default);
1617
return new ClaimsPrincipal(identity);
1718
}
1819
}

src/Server/Coderr.Server.App/Core/Accounts/AccountService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public async Task<bool> ResetPassword(string activationKey, string newPassword)
7979
/// <returns>
8080
/// Task which will contain the reply once completed.
8181
/// </returns>
82-
public async Task<ClaimsIdentity> ActivateAccount(ClaimsPrincipal user, string activationKey)
82+
public async Task<ClaimsIdentity> ActivateAccount(ClaimsPrincipal messagingPrincipal, string activationKey)
8383
{
8484
var account = await _repository.FindByActivationKeyAsync(activationKey);
8585
if (account == null)
@@ -91,13 +91,13 @@ public async Task<ClaimsIdentity> ActivateAccount(ClaimsPrincipal user, string a
9191
await _repository.UpdateAsync(account);
9292

9393

94-
if (!user.IsCurrentAccount(account.Id))
94+
if (!messagingPrincipal.IsCurrentAccount(account.Id))
9595
{
9696
var evt = new AccountActivated(account.Id, account.UserName)
9797
{
9898
EmailAddress = account.Email
9999
};
100-
await _messageBus.SendAsync(user, evt);
100+
await _messageBus.SendAsync(messagingPrincipal, evt);
101101
}
102102

103103

src/Server/Coderr.Server.App/Core/Accounts/CommandHandlers/RegisterAccountHandler.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public async Task HandleAsync(IMessageContext context, RegisterAccount command)
4949

5050
if (!string.IsNullOrEmpty(command.UserName) && await _repository.IsUserNameTakenAsync(command.UserName))
5151
{
52-
await SendAccountInfo(context, command.UserName);
5352
_logger.Warn("UserName is taken: " + command.UserName);
53+
await SendAccountInfo(context, command.UserName);
5454
return;
5555
}
5656

@@ -60,7 +60,10 @@ public async Task HandleAsync(IMessageContext context, RegisterAccount command)
6060
account.SetVerifiedEmail(command.Email);
6161

6262
if (command.ActivateDirectly)
63+
{
64+
_logger.Debug("Activating directly");
6365
account.Activate();
66+
}
6467

6568
var accountCount = await _repository.CountAsync();
6669
if (accountCount == 0)
@@ -122,7 +125,7 @@ private Task SendVerificationEmail(IMessageContext context, Account account)
122125
You can activate your account by clicking on: {1}/account/activate/{0}
123126
124127
Good luck,
125-
Coderr Team", account.ActivationKey, config.BaseUrl),
128+
Coderr Team", account.ActivationKey, config.BaseUrl.ToString().TrimEnd('/')),
126129
Subject = "Coderr activation"
127130
};
128131
msg.Recipients = new[] { new EmailAddress(account.Email) };

src/Server/Coderr.Server.App/Core/Accounts/IAccountService.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public interface IAccountService
1212
/// Accepts and deletes the invitation. Sends an event which is picked up by the application domain (which transforms
1313
/// the pending invite to a membership)
1414
/// </summary>
15+
/// <param name="messagingPrincipal">Logged in user.</param>
16+
/// <param name="request">Information about the accept invitation request</param>
17+
/// <returns>Updated identity with permission to the applications that the user was invited to.</returns>
1518
/// <remarks>
1619
/// <para>
1720
/// Do note that an invitation can be accepted by using another email address than the one that the invitation was
@@ -20,8 +23,14 @@ public interface IAccountService
2023
/// invitation.
2124
/// </para>
2225
/// </remarks>
23-
Task<ClaimsIdentity> AcceptInvitation(ClaimsPrincipal user, AcceptInvitation request);
26+
Task<ClaimsIdentity> AcceptInvitation(ClaimsPrincipal messagingPrincipal, AcceptInvitation request);
2427

28+
/// <summary>
29+
/// Validate login information (check if the specified information is available).
30+
/// </summary>
31+
/// <param name="emailAddress">Email address as specified by the user.</param>
32+
/// <param name="userName">Wanted userName</param>
33+
/// <returns></returns>
2534
Task<ValidateNewLoginReply> ValidateLogin(string emailAddress, string userName);
2635

2736
/// <summary>

0 commit comments

Comments
 (0)