forked from freesurfer/freebrowse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0 parents
commit 962be70
Showing
173 changed files
with
12,881 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# User-specific files (MonoDevelop/Xamarin Studio) | ||
*.userprefs | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
bin/ | ||
Bin/ | ||
obj/ | ||
Obj/ | ||
|
||
# Visual Studio 2015 cache/options directory | ||
.vs/ | ||
|
||
# Jetbrains Rider cache/options directory | ||
.idea/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
# NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opendb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
*.sap | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding add-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
nCrunchTemp_* | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
# TODO: Comment the next line if you want to checkin your web deploy settings | ||
# but database connection strings (with potential passwords) will be unencrypted | ||
*.pubxml | ||
*.publishproj | ||
|
||
# NuGet Packages | ||
*.nupkg | ||
# The packages folder can be ignored because of Package Restore | ||
**/packages/* | ||
# except build/, which is used as an MSBuild target. | ||
!**/packages/build/ | ||
# Uncomment if necessary however generally it will be regenerated when needed | ||
#!**/packages/repositories.config | ||
|
||
# Microsoft Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Microsoft Azure Emulator | ||
ecf/ | ||
rcf/ | ||
|
||
# Microsoft Azure ApplicationInsights config file | ||
ApplicationInsights.config | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
BundleArtifacts/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ | ||
|
||
# Others | ||
ClientBin/ | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
orleans.codegen.cs | ||
|
||
/node_modules | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ | ||
|
||
# GhostDoc plugin setting file | ||
*.GhostDoc.xml | ||
|
||
# Node.js Tools for Visual Studio | ||
.ntvs_analysis.dat | ||
|
||
# Visual Studio 6 build log | ||
*.plg | ||
|
||
# Visual Studio 6 workspace options file | ||
*.opt | ||
|
||
# Visual Studio LightSwitch build output | ||
**/*.HTMLClient/GeneratedArtifacts | ||
**/*.DesktopClient/GeneratedArtifacts | ||
**/*.DesktopClient/ModelManifest.xml | ||
**/*.Server/GeneratedArtifacts | ||
**/*.Server/ModelManifest.xml | ||
_Pvt_Extensions | ||
|
||
# Paket dependency manager | ||
.paket/paket.exe | ||
|
||
# FAKE - F# Make | ||
.fake/ | ||
/NDependOut | ||
/FreeViewWeb.ndproj | ||
/.mfractor | ||
src/WebUI/ClientApp/package-lock.json |
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,81 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "src\Domain\Domain.csproj", "{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "src\Application\Application.csproj", "{34C0FACD-F3D9-400C-8945-554DD6B0819A}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{117DA02F-5274-4565-ACC6-DA9B6E568B09}" | ||
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}") = "Application.UnitTests", "tests\Application.UnitTests\Application.UnitTests.csproj", "{DEFF4009-1FAB-4392-80B6-707E2DC5C00B}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain.UnitTests", "tests\Domain.UnitTests\Domain.UnitTests.csproj", "{DC37FD87-552C-4613-9F16-1537CA522898}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application.IntegrationTests", "tests\Application.IntegrationTests\Application.IntegrationTests.csproj", "{277029AF-D9E1-4B75-9F11-48FEA7345AD7}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebUI", "src\WebUI\WebUI.csproj", "{22454EE9-16B3-4B7A-8352-37E59B858155}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E2DA20AA-28D1-455C-BF50-C49A8F831633}" | ||
ProjectSection(SolutionItems) = preProject | ||
.editorconfig = .editorconfig | ||
.gitignore = .gitignore | ||
global.json = global.json | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{34C0FACD-F3D9-400C-8945-554DD6B0819A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{34C0FACD-F3D9-400C-8945-554DD6B0819A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{34C0FACD-F3D9-400C-8945-554DD6B0819A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{34C0FACD-F3D9-400C-8945-554DD6B0819A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{117DA02F-5274-4565-ACC6-DA9B6E568B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{117DA02F-5274-4565-ACC6-DA9B6E568B09}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{117DA02F-5274-4565-ACC6-DA9B6E568B09}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{117DA02F-5274-4565-ACC6-DA9B6E568B09}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{DEFF4009-1FAB-4392-80B6-707E2DC5C00B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DEFF4009-1FAB-4392-80B6-707E2DC5C00B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DEFF4009-1FAB-4392-80B6-707E2DC5C00B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DEFF4009-1FAB-4392-80B6-707E2DC5C00B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{DC37FD87-552C-4613-9F16-1537CA522898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DC37FD87-552C-4613-9F16-1537CA522898}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DC37FD87-552C-4613-9F16-1537CA522898}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DC37FD87-552C-4613-9F16-1537CA522898}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{277029AF-D9E1-4B75-9F11-48FEA7345AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{277029AF-D9E1-4B75-9F11-48FEA7345AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{277029AF-D9E1-4B75-9F11-48FEA7345AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{277029AF-D9E1-4B75-9F11-48FEA7345AD7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{22454EE9-16B3-4B7A-8352-37E59B858155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{22454EE9-16B3-4B7A-8352-37E59B858155}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{22454EE9-16B3-4B7A-8352-37E59B858155}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{22454EE9-16B3-4B7A-8352-37E59B858155}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} | ||
{34C0FACD-F3D9-400C-8945-554DD6B0819A} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} | ||
{117DA02F-5274-4565-ACC6-DA9B6E568B09} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} | ||
{DEFF4009-1FAB-4392-80B6-707E2DC5C00B} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} | ||
{DC37FD87-552C-4613-9F16-1537CA522898} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} | ||
{277029AF-D9E1-4B75-9F11-48FEA7345AD7} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} | ||
{22454EE9-16B3-4B7A-8352-37E59B858155} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3CB609D9-5D54-4C11-A371-DAAC8B74E430} | ||
EndGlobalSection | ||
EndGlobal |
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,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.100", | ||
"rollForward": "latestMinor" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Application/Accounts/Commands/RegisterAccount/RegisterAccountCommand.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,34 @@ | ||
using FreeBrowse.Application.Common.Exceptions; | ||
using FreeBrowse.Application.Common.Interfaces; | ||
using MediatR; | ||
|
||
namespace FreeBrowse.Application.Accounts.Commands.RegisterAccount; | ||
|
||
public record RegisterAccountCommand : IRequest<string> | ||
{ | ||
public string? Username { get; init; } | ||
|
||
public string? Password { get; init; } | ||
} | ||
|
||
internal class RegisterAccountCommandHandler : IRequestHandler<RegisterAccountCommand, string> | ||
{ | ||
private readonly IIdentityService identityService; | ||
|
||
public RegisterAccountCommandHandler(IIdentityService identityService) | ||
{ | ||
this.identityService = identityService; | ||
} | ||
|
||
public async Task<string> Handle(RegisterAccountCommand request, CancellationToken cancellationToken) | ||
{ | ||
var registration = await this.identityService.CreateUserAsync(request.Username!, request.Password!); | ||
|
||
if (!registration.Result.Succeeded) | ||
{ | ||
throw new ValidationException(); | ||
} | ||
|
||
return registration.UserId; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Application/Accounts/Commands/RegisterAccount/RegisterAccountCommandValidator.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 FluentValidation; | ||
using FreeBrowse.Application.Common.Interfaces; | ||
|
||
namespace FreeBrowse.Application.Accounts.Commands.RegisterAccount; | ||
|
||
public class RegisterAccountCommandValidator : AbstractValidator<RegisterAccountCommand> | ||
{ | ||
private readonly IIdentityService identityService; | ||
|
||
public RegisterAccountCommandValidator(IIdentityService identityService) | ||
{ | ||
this.identityService = identityService; | ||
|
||
this.RuleFor(x => x.Username) | ||
.MinimumLength(3).WithMessage("The username must be longer than 2 characters.") | ||
.MaximumLength(20).WithMessage("The username must not be longer than 20 characters.") | ||
.Must(this.NotExist).WithMessage("The username is already taken.") | ||
.NotEmpty().WithMessage("The username must not be empty."); | ||
|
||
this.RuleFor(x => x.Password) | ||
.MinimumLength(3).WithMessage("The password must be longer than 2 characters.") | ||
.MaximumLength(20).WithMessage("The password must not be longer than 20 characters.") | ||
.NotEmpty().WithMessage("The password must not be empty."); | ||
} | ||
|
||
private bool NotExist(string username) | ||
{ | ||
return !this.identityService.IsUsernameTaken(username); | ||
} | ||
} |
Oops, something went wrong.