Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/

/Codidact/wwwroot/lib
/Codidact/appsettings.Development.json

# TypeScript result files
**/wwwroot/scripts/**/*.js
**/wwwroot/scripts/**/*.js.map

**/node_modules
**/node_modules
77 changes: 7 additions & 70 deletions Codidact.sln
Original file line number Diff line number Diff line change
@@ -1,88 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29319.158
VisualStudioVersion = 16.0.29926.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BBC73188-F22A-4ECF-92E4-A5E078F29245}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CONTRIBUTING.md = CONTRIBUTING.md
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6ED356A7-8B47-4613-AD01-C85CF28491BD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{664D406C-2F83-48F0-BFC3-408D5CB53C65}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp", "src\WebApp\WebApp.csproj", "{A5AEFB21-B060-451F-B905-85EDF562ECA1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "src\Application\Application.csproj", "{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "src\Domain\Domain.csproj", "{C2386A60-2A46-4F73-8FA0-5846F62C829F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{A35CAC23-B7E6-44AB-84DC-D51A9462907C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain.UnitTests", "tests\Domain.UnitTests\Domain.UnitTests.csproj", "{1635B811-CD24-404E-9F41-3D9D852C89D5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.IntegrationTests", "tests\Infrastructure.IntegrationTests\Infrastructure.IntegrationTests.csproj", "{54C078A7-BC28-4080-94FF-FD1214CF8F69}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp.IntegrationTests", "tests\WebApp.IntegrationTests\WebApp.IntegrationTests.csproj", "{FB50E42B-7CB0-456F-B1B7-C6250BAD8692}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application.UnitTests", "tests\Application.UnitTests\Application.UnitTests.csproj", "{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codidact", "Codidact\Codidact.csproj", "{43DBC300-C592-4768-A14E-C031131A1E12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5AEFB21-B060-451F-B905-85EDF562ECA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5AEFB21-B060-451F-B905-85EDF562ECA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5AEFB21-B060-451F-B905-85EDF562ECA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5AEFB21-B060-451F-B905-85EDF562ECA1}.Release|Any CPU.Build.0 = Release|Any CPU
{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592}.Release|Any CPU.Build.0 = Release|Any CPU
{C2386A60-2A46-4F73-8FA0-5846F62C829F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2386A60-2A46-4F73-8FA0-5846F62C829F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2386A60-2A46-4F73-8FA0-5846F62C829F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2386A60-2A46-4F73-8FA0-5846F62C829F}.Release|Any CPU.Build.0 = Release|Any CPU
{A35CAC23-B7E6-44AB-84DC-D51A9462907C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A35CAC23-B7E6-44AB-84DC-D51A9462907C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A35CAC23-B7E6-44AB-84DC-D51A9462907C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A35CAC23-B7E6-44AB-84DC-D51A9462907C}.Release|Any CPU.Build.0 = Release|Any CPU
{1635B811-CD24-404E-9F41-3D9D852C89D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1635B811-CD24-404E-9F41-3D9D852C89D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1635B811-CD24-404E-9F41-3D9D852C89D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1635B811-CD24-404E-9F41-3D9D852C89D5}.Release|Any CPU.Build.0 = Release|Any CPU
{54C078A7-BC28-4080-94FF-FD1214CF8F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54C078A7-BC28-4080-94FF-FD1214CF8F69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54C078A7-BC28-4080-94FF-FD1214CF8F69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54C078A7-BC28-4080-94FF-FD1214CF8F69}.Release|Any CPU.Build.0 = Release|Any CPU
{FB50E42B-7CB0-456F-B1B7-C6250BAD8692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB50E42B-7CB0-456F-B1B7-C6250BAD8692}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB50E42B-7CB0-456F-B1B7-C6250BAD8692}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB50E42B-7CB0-456F-B1B7-C6250BAD8692}.Release|Any CPU.Build.0 = Release|Any CPU
{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E}.Release|Any CPU.Build.0 = Release|Any CPU
{43DBC300-C592-4768-A14E-C031131A1E12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43DBC300-C592-4768-A14E-C031131A1E12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43DBC300-C592-4768-A14E-C031131A1E12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43DBC300-C592-4768-A14E-C031131A1E12}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A5AEFB21-B060-451F-B905-85EDF562ECA1} = {6ED356A7-8B47-4613-AD01-C85CF28491BD}
{FC1D3B78-9C5C-403B-BFB9-3D57AF36A592} = {6ED356A7-8B47-4613-AD01-C85CF28491BD}
{C2386A60-2A46-4F73-8FA0-5846F62C829F} = {6ED356A7-8B47-4613-AD01-C85CF28491BD}
{A35CAC23-B7E6-44AB-84DC-D51A9462907C} = {6ED356A7-8B47-4613-AD01-C85CF28491BD}
{1635B811-CD24-404E-9F41-3D9D852C89D5} = {664D406C-2F83-48F0-BFC3-408D5CB53C65}
{54C078A7-BC28-4080-94FF-FD1214CF8F69} = {664D406C-2F83-48F0-BFC3-408D5CB53C65}
{FB50E42B-7CB0-456F-B1B7-C6250BAD8692} = {664D406C-2F83-48F0-BFC3-408D5CB53C65}
{595DAD6B-4CC1-4B6D-9CD8-E2381A36983E} = {664D406C-2F83-48F0-BFC3-408D5CB53C65}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {80AE56D1-6AAB-452A-9820-7893F0DC62AD}
SolutionGuid = {91874013-5F3C-4621-A15A-231C8915E8C8}
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions Codidact/Areas/Identity/IdentityHostingStartup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using Codidact;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

[assembly: HostingStartup(typeof(Codidact.Areas.Identity.IdentityHostingStartup))]
namespace Codidact.Areas.Identity
{
public class IdentityHostingStartup : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureServices((context, services) => {
});
}
}
}
10 changes: 10 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/AccessDenied.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page
@model AccessDeniedModel
@{
ViewData["Title"] = "Access denied";
}

<header>
<h1 class="text-danger">@ViewData["Title"]</h1>
<p class="text-danger">You do not have access to this resource.</p>
</header>
17 changes: 17 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Codidact.Areas.Identity.Pages.Account
{
public class AccessDeniedModel : PageModel
{
public void OnGet()
{

}
}
}

8 changes: 8 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/ConfirmEmail.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page
@model ConfirmEmailModel
@{
ViewData["Title"] = "Confirm email";
}

<h1>@ViewData["Title"]</h1>
<partial name="_StatusMessage" model="Model.StatusMessage" />
47 changes: 47 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Codidact;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;

namespace Codidact.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class ConfirmEmailModel : PageModel
{
private readonly UserManager<Users> _userManager;

public ConfirmEmailModel(UserManager<Users> userManager)
{
_userManager = userManager;
}

[TempData]
public string StatusMessage { get; set; }

public async Task<IActionResult> OnGetAsync(string userId, string code)
{
if (userId == null || code == null)
{
return RedirectToPage("/Index");
}

var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
return NotFound($"Unable to load user with ID '{userId}'.");
}

code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code));
var result = await _userManager.ConfirmEmailAsync(user, code);
StatusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email.";
return Page();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page
@model ConfirmEmailChangeModel
@{
ViewData["Title"] = "Confirm email change";
}

<h1>@ViewData["Title"]</h1>
<partial name="_StatusMessage" model="Model.StatusMessage" />
65 changes: 65 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Codidact;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;

namespace Codidact.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class ConfirmEmailChangeModel : PageModel
{
private readonly UserManager<Users> _userManager;
private readonly SignInManager<Users> _signInManager;

public ConfirmEmailChangeModel(UserManager<Users> userManager, SignInManager<Users> signInManager)
{
_userManager = userManager;
_signInManager = signInManager;
}

[TempData]
public string StatusMessage { get; set; }

public async Task<IActionResult> OnGetAsync(string userId, string email, string code)
{
if (userId == null || email == null || code == null)
{
return RedirectToPage("/Index");
}

var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
return NotFound($"Unable to load user with ID '{userId}'.");
}

code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code));
var result = await _userManager.ChangeEmailAsync(user, email, code);
if (!result.Succeeded)
{
StatusMessage = "Error changing email.";
return Page();
}

// In our UI email and user name are one and the same, so when we update the email
// we need to update the user name.
var setUserNameResult = await _userManager.SetUserNameAsync(user, email);
if (!setUserNameResult.Succeeded)
{
StatusMessage = "Error changing user name.";
return Page();
}

await _signInManager.RefreshSignInAsync(user);
StatusMessage = "Thank you for confirming your email change.";
return Page();
}
}
}
33 changes: 33 additions & 0 deletions Codidact/Areas/Identity/Pages/Account/ExternalLogin.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@page
@model ExternalLoginModel
@{
ViewData["Title"] = "Register";
}

<h1>@ViewData["Title"]</h1>
<h4>Associate your @Model.LoginProvider account.</h4>
<hr />

<p class="text-info">
You've successfully authenticated with <strong>@Model.LoginProvider</strong>.
Please enter an email address for this site below and click the Register button to finish
logging in.
</p>

<div class="row">
<div class="col-md-4">
<form asp-page-handler="Confirmation" asp-route-returnUrl="@Model.ReturnUrl" method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>

@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
Loading