Skip to content

Commit

Permalink
Package updates and add registration API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
webprofusion-chrisc committed Nov 29, 2023
1 parent b5603b5 commit 78bd0e6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion API/OCM.Net/OCM.API.Core/Common/UserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public User RegisterNewUser(API.Common.Model.RegistrationModel model)
SetNewPassword(userDetails.Id, (PasswordChangeModel)model);
AssignNewSessionToken(userDetails.Id);

return API.Common.Model.Extensions.User.BasicFromDataModel(userDetails);
return GetUser(userDetails.Id);
}

public User GetUser(int id)
Expand Down
2 changes: 1 addition & 1 deletion API/OCM.Net/OCM.API.Core/OCM.API.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.300.2" />
<PackageReference Include="AWSSDK.S3" Version="3.7.304" />
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
<PackageReference Include="GeoCoordinate.NetStandard1" Version="1.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ private async Task OutputProfileRegisterResult(IOutputProvider outputProvider, H
string access_token = null;
var responseEnvelope = new APIResponseEnvelope();

if (user != null)
if (user == null)
{
context.Response.StatusCode = 401;
return;
Expand Down Expand Up @@ -845,6 +845,13 @@ private void SetAPIDefaults(HttpContext context)
this.IsQueryByPost = true;
}

if (context.Request.Path.ToString().Contains("profile/register"))
{
this.APIBehaviourVersion = 3;
this.DefaultAction = "profile.register";
this.IsQueryByPost = true;
}

if (context.Request.Path.ToString().Contains("comment"))
{
this.APIBehaviourVersion = 3;
Expand Down
5 changes: 2 additions & 3 deletions API/OCM.Net/OCM.API.Web/Controllers/ProfileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public ActionResult Authenticate(LoginModel login)
}

[HttpPost]

public ActionResult Register([FromBody]LoginModel registration)
public ActionResult Register([FromBody] RegistrationModel registration)
{
if (string.IsNullOrWhiteSpace(registration.EmailAddress))
{
Expand All @@ -58,7 +57,7 @@ public ActionResult Register([FromBody]LoginModel registration)
if (!userManager.IsExistingUser(registration.EmailAddress))
{
// credentials don't match existing user
var user = userManager.RegisterNewUser(new RegistrationModel { EmailAddress=registration.EmailAddress, Password=registration.Password, Username = registration.Username});
var user = userManager.RegisterNewUser(registration);

if (user == null)
{
Expand Down
2 changes: 1 addition & 1 deletion Import/OCM.Import.Common/OCM.Import.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.0" />
<PackageReference Include="DotNetProjects.IndexedLinq" Version="2.0.18" />
<PackageReference Include="GeoCoordinate.NetStandard1" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions Tests/OCM.API.Tests/OCM.API.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion Website/OCM.Web/OCM.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.2.2">
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 78bd0e6

Please sign in to comment.