Added login stuff

This commit is contained in:
Eljakim Herrewijnen 2020-02-12 21:47:19 +01:00
parent b67195ae56
commit 72f849ef89
36 changed files with 14366 additions and 12635 deletions

View File

@ -1,25 +1,25 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.28803.452 VisualStudioVersion = 16.0.28803.452
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Website\Website.csproj", "{0290D04F-D332-4462-8D3A-DF5B7E35A997}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Website\Website.csproj", "{0290D04F-D332-4462-8D3A-DF5B7E35A997}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0290D04F-D332-4462-8D3A-DF5B7E35A997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0290D04F-D332-4462-8D3A-DF5B7E35A997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0290D04F-D332-4462-8D3A-DF5B7E35A997}.Debug|Any CPU.Build.0 = Debug|Any CPU {0290D04F-D332-4462-8D3A-DF5B7E35A997}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0290D04F-D332-4462-8D3A-DF5B7E35A997}.Release|Any CPU.ActiveCfg = Release|Any CPU {0290D04F-D332-4462-8D3A-DF5B7E35A997}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0290D04F-D332-4462-8D3A-DF5B7E35A997}.Release|Any CPU.Build.0 = Release|Any CPU {0290D04F-D332-4462-8D3A-DF5B7E35A997}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DD8CE8B9-15E1-4126-ADB3-6149692FBB3C} SolutionGuid = {DD8CE8B9-15E1-4126-ADB3-6149692FBB3C}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,234 +1,234 @@
/Properties/launchSettings.json /Properties/launchSettings.json
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
*.userosscache *.userosscache
*.sln.docstates *.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio) # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs *.userprefs
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
[Dd]ebugPublic/ [Dd]ebugPublic/
[Rr]elease/ [Rr]elease/
[Rr]eleases/ [Rr]eleases/
x64/ x64/
x86/ x86/
build/ build/
bld/ bld/
bin/ bin/
Bin/ Bin/
obj/ obj/
Obj/ Obj/
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
/wwwroot/dist/ /wwwroot/dist/
# MSTest test Results # MSTest test Results
[Tt]est[Rr]esult*/ [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.* [Bb]uild[Ll]og.*
# NUNIT # NUNIT
*.VisualState.xml *.VisualState.xml
TestResult.xml TestResult.xml
# Build Results of an ATL Project # Build Results of an ATL Project
[Dd]ebugPS/ [Dd]ebugPS/
[Rr]eleasePS/ [Rr]eleasePS/
dlldata.c dlldata.c
*_i.c *_i.c
*_p.c *_p.c
*_i.h *_i.h
*.ilk *.ilk
*.meta *.meta
*.obj *.obj
*.pch *.pch
*.pdb *.pdb
*.pgc *.pgc
*.pgd *.pgd
*.rsp *.rsp
*.sbr *.sbr
*.tlb *.tlb
*.tli *.tli
*.tlh *.tlh
*.tmp *.tmp
*.tmp_proj *.tmp_proj
*.log *.log
*.vspscc *.vspscc
*.vssscc *.vssscc
.builds .builds
*.pidb *.pidb
*.svclog *.svclog
*.scc *.scc
# Chutzpah Test files # Chutzpah Test files
_Chutzpah* _Chutzpah*
# Visual C++ cache files # Visual C++ cache files
ipch/ ipch/
*.aps *.aps
*.ncb *.ncb
*.opendb *.opendb
*.opensdf *.opensdf
*.sdf *.sdf
*.cachefile *.cachefile
# Visual Studio profiler # Visual Studio profiler
*.psess *.psess
*.vsp *.vsp
*.vspx *.vspx
*.sap *.sap
# TFS 2012 Local Workspace # TFS 2012 Local Workspace
$tf/ $tf/
# Guidance Automation Toolkit # Guidance Automation Toolkit
*.gpState *.gpState
# ReSharper is a .NET coding add-in # ReSharper is a .NET coding add-in
_ReSharper*/ _ReSharper*/
*.[Rr]e[Ss]harper *.[Rr]e[Ss]harper
*.DotSettings.user *.DotSettings.user
# JustCode is a .NET coding add-in # JustCode is a .NET coding add-in
.JustCode .JustCode
# TeamCity is a build add-in # TeamCity is a build add-in
_TeamCity* _TeamCity*
# DotCover is a Code Coverage Tool # DotCover is a Code Coverage Tool
*.dotCover *.dotCover
# NCrunch # NCrunch
_NCrunch_* _NCrunch_*
.*crunch*.local.xml .*crunch*.local.xml
nCrunchTemp_* nCrunchTemp_*
# MightyMoose # MightyMoose
*.mm.* *.mm.*
AutoTest.Net/ AutoTest.Net/
# Web workbench (sass) # Web workbench (sass)
.sass-cache/ .sass-cache/
# Installshield output folder # Installshield output folder
[Ee]xpress/ [Ee]xpress/
# DocProject is a documentation generator add-in # DocProject is a documentation generator add-in
DocProject/buildhelp/ DocProject/buildhelp/
DocProject/Help/*.HxT DocProject/Help/*.HxT
DocProject/Help/*.HxC DocProject/Help/*.HxC
DocProject/Help/*.hhc DocProject/Help/*.hhc
DocProject/Help/*.hhk DocProject/Help/*.hhk
DocProject/Help/*.hhp DocProject/Help/*.hhp
DocProject/Help/Html2 DocProject/Help/Html2
DocProject/Help/html DocProject/Help/html
# Click-Once directory # Click-Once directory
publish/ publish/
# Publish Web Output # Publish Web Output
*.[Pp]ublish.xml *.[Pp]ublish.xml
*.azurePubxml *.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings # TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted # but database connection strings (with potential passwords) will be unencrypted
*.pubxml *.pubxml
*.publishproj *.publishproj
# NuGet Packages # NuGet Packages
*.nupkg *.nupkg
# The packages folder can be ignored because of Package Restore # The packages folder can be ignored because of Package Restore
**/packages/* **/packages/*
# except build/, which is used as an MSBuild target. # except build/, which is used as an MSBuild target.
!**/packages/build/ !**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed # Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config #!**/packages/repositories.config
# Microsoft Azure Build Output # Microsoft Azure Build Output
csx/ csx/
*.build.csdef *.build.csdef
# Microsoft Azure Emulator # Microsoft Azure Emulator
ecf/ ecf/
rcf/ rcf/
# Microsoft Azure ApplicationInsights config file # Microsoft Azure ApplicationInsights config file
ApplicationInsights.config ApplicationInsights.config
# Windows Store app package directory # Windows Store app package directory
AppPackages/ AppPackages/
BundleArtifacts/ BundleArtifacts/
# Visual Studio cache files # Visual Studio cache files
# files ending in .cache can be ignored # files ending in .cache can be ignored
*.[Cc]ache *.[Cc]ache
# but keep track of directories ending in .cache # but keep track of directories ending in .cache
!*.[Cc]ache/ !*.[Cc]ache/
# Others # Others
ClientBin/ ClientBin/
~$* ~$*
*~ *~
*.dbmdl *.dbmdl
*.dbproj.schemaview *.dbproj.schemaview
*.pfx *.pfx
*.publishsettings *.publishsettings
orleans.codegen.cs orleans.codegen.cs
/node_modules /node_modules
# RIA/Silverlight projects # RIA/Silverlight projects
Generated_Code/ Generated_Code/
# Backup & report files from converting an old project file # Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed, # to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-) # because we have git ;-)
_UpgradeReport_Files/ _UpgradeReport_Files/
Backup*/ Backup*/
UpgradeLog*.XML UpgradeLog*.XML
UpgradeLog*.htm UpgradeLog*.htm
# SQL Server files # SQL Server files
*.mdf *.mdf
*.ldf *.ldf
# Business Intelligence projects # Business Intelligence projects
*.rdl.data *.rdl.data
*.bim.layout *.bim.layout
*.bim_*.settings *.bim_*.settings
# Microsoft Fakes # Microsoft Fakes
FakesAssemblies/ FakesAssemblies/
# GhostDoc plugin setting file # GhostDoc plugin setting file
*.GhostDoc.xml *.GhostDoc.xml
# Node.js Tools for Visual Studio # Node.js Tools for Visual Studio
.ntvs_analysis.dat .ntvs_analysis.dat
# Visual Studio 6 build log # Visual Studio 6 build log
*.plg *.plg
# Visual Studio 6 workspace options file # Visual Studio 6 workspace options file
*.opt *.opt
# Visual Studio LightSwitch build output # Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts **/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml **/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts **/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml **/*.Server/ModelManifest.xml
_Pvt_Extensions _Pvt_Extensions
# Paket dependency manager # Paket dependency manager
.paket/paket.exe .paket/paket.exe
# FAKE - F# Make # FAKE - F# Make
.fake/ .fake/

View File

@ -1,21 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files. # See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules /node_modules
# testing # testing
/coverage /coverage
# production # production
/build /build
# misc # misc
.DS_Store .DS_Store
.env.local .env.local
.env.development.local .env.development.local
.env.test.local .env.test.local
.env.production.local .env.production.local
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,22 @@
{ {
"name": "Website", "name": "Website",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"bootstrap": "^3.4.1", "bootstrap": "^3.4.1",
"react": "^16.0.0", "js-cookie": "^2.2.1",
"react-bootstrap": "^0.31.5", "react": "^16.0.0",
"react-dom": "^16.0.0", "react-bootstrap": "^0.31.5",
"react-router-bootstrap": "^0.24.4", "react-dom": "^16.0.0",
"react-router-dom": "^4.2.2", "react-router-bootstrap": "^0.24.4",
"react-scripts": "1.0.17", "react-router-dom": "^4.2.2",
"rimraf": "^2.6.2" "react-scripts": "1.0.17",
}, "rimraf": "^2.6.2"
"scripts": { },
"start": "rimraf ./build && react-scripts start", "scripts": {
"build": "react-scripts build", "start": "rimraf ./build && react-scripts start",
"test": "react-scripts test --env=jsdom", "build": "react-scripts build",
"eject": "react-scripts eject" "test": "react-scripts test --env=jsdom",
} "eject": "react-scripts eject"
} }
}

View File

@ -1,41 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000"> <meta name="theme-color" content="#000000">
<base href="%PUBLIC_URL%/" /> <base href="%PUBLIC_URL%/" />
<!-- <!--
manifest.json provides metadata used when your web app is added to the manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML. Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>Website</title> <title>Website</title>
</head> </head>
<body> <body>
<noscript> <noscript>
You need to enable JavaScript to run this app. You need to enable JavaScript to run this app.
</noscript> </noscript>
<div id="root"></div> <div id="root"></div>
<!-- <!--
This HTML file is a template. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file. You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag. The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`. To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`. To create a production bundle, use `npm run build` or `yarn build`.
--> -->
</body> </body>
</html> </html>

View File

@ -1,15 +1,15 @@
{ {
"short_name": "Website", "short_name": "Website",
"name": "Website", "name": "Website",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16", "sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon" "type": "image/x-icon"
} }
], ],
"start_url": "./index.html", "start_url": "./index.html",
"display": "standalone", "display": "standalone",
"theme_color": "#000000", "theme_color": "#000000",
"background_color": "#ffffff" "background_color": "#ffffff"
} }

View File

@ -1,16 +1,22 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Route } from 'react-router'; import { Route } from 'react-router';
import { Layout } from './components/Layout'; import { Layout } from './components/Layout';
import { Home } from './components/Home'; import { Home } from './components/Home';
import { Leden } from './components/Leden';
export default class App extends Component { import { OverIchthus } from './components/OverIchthus';
displayName = App.name import { Login } from './components/Login';
render() { export default class App extends Component {
return ( displayName = App.name
<Layout>
<Route exact path='/' component={Home} /> render() {
</Layout> return (
); <Layout>
} <Route exact path='/' component={Home} />
} <Route exact path='/leden' component={Leden} />
<Route exact path='/overichthus' component={OverIchthus} />
<Route exact path='/login' component={Login} />
</Layout>
);
}
}

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import App from './App'; import App from './App';
it('renders without crashing', () => { it('renders without crashing', () => {
const div = document.createElement('div'); const div = document.createElement('div');
ReactDOM.render(<App />, div); ReactDOM.render(<App />, div);
}); });

View File

@ -1,14 +1,14 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
export class Home extends Component { export class Home extends Component {
displayName = Home.name displayName = Home.name
render() { render() {
return ( return (
<div> <div>
<h1>Hello, world!</h1> <h1>Ichthus</h1>
<p>Welcome to your new single-page application, built with:</p> <p>Welcome to your new single-page application, built with:</p>
</div> </div>
); );
} }
} }

View File

@ -1,13 +1,18 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Col, Grid, Row } from 'react-bootstrap'; import { Col, Grid, Row } from 'react-bootstrap';
import { NavMenu } from './NavMenu'; import { NavMenu } from './NavMenu';
export class Layout extends Component { export class Layout extends Component {
displayName = Layout.name displayName = Layout.name
render() { render() {
return ( return (
<NavMenu /> <div>
); <NavMenu />
} <div>
} {this.props.children}
</div>
</div>
);
}
}

View File

@ -0,0 +1,29 @@
#LoginBlock{
width: 80%;
/*border: 1px solid black;*/
height: 30%;
margin:10%;
}
#TextBlock {
/*display: inline-block;*/
margin-left: 40%;
width: 100%;
padding: 1%;
}
#LoginTextUsername {
padding: 1%;
margin: 0 auto;
width: 20%;
}
#LoginTextPassword {
padding: 1%;
margin: 0 auto;
width: 20%;
}
#CreateInputFieldText {
width: 100%;
padding: 1%;
margin: 0 auto;
}

View File

@ -0,0 +1,52 @@
import React, { Component } from 'react';
import Cookies from 'js-cookie';
import { Redirect } from 'react-router';
export class Leden extends Component {
constructor(props) {
super(props)
this.WriteData = this.WriteData.bind(this);
this.state = {
username: "",
loggedIn: false,
session: ""
};
}
//This function will run when the site is loading
componentWillMount() {
document.title = "CSFR - Ichthus";
this.getData();
}
componentDidMount() {
let current = this;
}
WriteData() {
this.setState({
})
}
getData() {
var ses = Cookies.get('session');
if (ses !== "" && typeof ses !== 'undefined') {
this.setState({ session: ses, loggedIn: true });
}
}
render() {
if (!this.state.loggedIn) {
return (<Redirect to="/login" />);
}
else {
return (
<div>
<h1>Leden</h1>
<p>Welcome to your new single-page application, built with:</p>
</div>
);
}
}
}

View File

@ -0,0 +1,21 @@
import React, { Component } from 'react';
import { Col, Grid, Row } from 'react-bootstrap';
import { NavMenu } from './NavMenu';
import "./Leden.css";
export class Login extends Component {
render() {
return (
<div id="LoginBlock">
<div id="TextBlock">
<input type="text" id="LoginTextUsername" onChange={this.CreatePersonenChange} placeholder="Gebruikersnaam" />
</div>
<div id="TextBlock">
<input type="password" id="LoginTextPassword" onChange={this.CreatePersonenChange} placeholder="Wachtwoord" />
</div>
</div>
);
}
}

View File

@ -1,27 +1,27 @@
#MenuBar { #MenuBar {
width: 100%; width: 100%;
margin: 1.5%; margin: 1.5%;
} }
#MenuBlock { #MenuBlock {
width: 12%; width: 12%;
/* height: 18%; */ /* height: 18%; */
padding: 1%; padding: 1%;
position: relative; position: relative;
float: right; float: right;
right: 0%; right: 0%;
} }
#MenuBlock:hover { #MenuBlock:hover {
background-color: yellow; background-color: yellow;
} }
#MenuText { #MenuText {
text-decoration: none; text-decoration: none;
font-size: 16px; font-size: 16px;
font-family: "Helvetica"; font-family: "Helvetica";
font-style: italic; font-style: italic;
text-align: center; text-align: center;
display: block; display: block;
color: #071139; color: #071139;
} }

View File

@ -1,47 +1,46 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Glyphicon, Nav, Navbar, NavItem } from 'react-bootstrap'; import { Home } from './Home';
import { LinkContainer } from 'react-router-bootstrap'; import Cookies from 'js-cookie';
import './NavMenu.css'; import './NavMenu.css';
export class NavMenu extends Component { export class NavMenu extends Component {
displayName = NavMenu.name displayName = NavMenu.name
render() { render() {
return ( return (
<div id="MenuBar"> <div id="MenuBar">
{/* Hier het Dispuuts logo met Knopje */} {/* Hier het Dispuuts logo met Knopje */}
<Link to={`/`}> <Link to={`/`}>
<img src="images/logodispuut.png" alt="LogoDipsuut" /> <img src="images/logodispuut.png" alt="LogoDipsuut" />
</Link> </Link>
{/* Hier menu knoppen op volgorde van Rechts naar Links */} {/* Hier menu knoppen op volgorde van Rechts naar Links */}
<div id="MenuBlock"> <div id="MenuBlock">
<Link to={`/leden/`} id="MenuText"> <Link to={'/leden/'} id="MenuText">
Leden Leden
</Link> </Link>
</div> </div>
<div id="MenuBlock"> <div id="MenuBlock">
<Link to={`/christenzijn/`} id="MenuText"> <Link to={`/christenzijn/`} id="MenuText">
Christen zijn Christen zijn
</Link> </Link>
</div> </div>
<div id="MenuBlock"> <div id="MenuBlock">
<Link to={`/studereninrotterdam/`} id="MenuText"> <Link to={`/studereninrotterdam/`} id="MenuText">
Studeren in Rotterdam Studeren in Rotterdam
</Link> </Link>
</div> </div>
<div id="MenuBlock"> <div id="MenuBlock">
<Link to={`/overichthus/`} id="MenuText"> <Link to={`/overichthus/`} id="MenuText">
Over Ichthus Over Ichthus
</Link> </Link>
</div>
</div> </div>
</div> );
); }
} }
}

View File

@ -0,0 +1,15 @@
import React, { Component } from 'react';
export class OverIchthus extends Component {
displayName = OverIchthus.name
render() {
return (
<div>
<h1>Over Ichthus</h1>
<p>Welcome to your new single-page application, built with:</p>
</div>
);
}
}

View File

@ -1,19 +1,19 @@
import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css'; import 'bootstrap/dist/css/bootstrap-theme.css';
import './index.css'; import './index.css';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import App from './App'; import App from './App';
import registerServiceWorker from './registerServiceWorker'; import registerServiceWorker from './registerServiceWorker';
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href'); const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
const rootElement = document.getElementById('root'); const rootElement = document.getElementById('root');
ReactDOM.render( ReactDOM.render(
<BrowserRouter basename={baseUrl}> <BrowserRouter basename={baseUrl}>
<App /> <App />
</BrowserRouter>, </BrowserRouter>,
rootElement); rootElement);
registerServiceWorker(); registerServiceWorker();

View File

@ -1,108 +1,108 @@
// In production, we register a service worker to serve assets from local cache. // In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives // This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users) // it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the "N+1" visit to a page, since previously // will only see deployed updates on the "N+1" visit to a page, since previously
// cached resources are updated in the background. // cached resources are updated in the background.
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. // To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior. // This link also includes instructions on opting out of this behavior.
const isLocalhost = Boolean( const isLocalhost = Boolean(
window.location.hostname === 'localhost' || window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' || window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
) )
); );
export default function register() { export default function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
if (publicUrl.origin !== window.location.origin) { if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin // Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to // from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374
return; return;
} }
window.addEventListener('load', () => { window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
// This is running on localhost. Lets check if a service worker still exists or not. // This is running on localhost. Lets check if a service worker still exists or not.
checkValidServiceWorker(swUrl); checkValidServiceWorker(swUrl);
} else { } else {
// Is not local host. Just register service worker // Is not local host. Just register service worker
registerValidSW(swUrl); registerValidSW(swUrl);
} }
}); });
} }
} }
function registerValidSW(swUrl) { function registerValidSW(swUrl) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then(registration => { .then(registration => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') { if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and // At this point, the old content will have been purged and
// the fresh content will have been added to the cache. // the fresh content will have been added to the cache.
// It's the perfect time to display a "New content is // It's the perfect time to display a "New content is
// available; please refresh." message in your web app. // available; please refresh." message in your web app.
console.log('New content is available; please refresh.'); console.log('New content is available; please refresh.');
} else { } else {
// At this point, everything has been precached. // At this point, everything has been precached.
// It's the perfect time to display a // It's the perfect time to display a
// "Content is cached for offline use." message. // "Content is cached for offline use." message.
console.log('Content is cached for offline use.'); console.log('Content is cached for offline use.');
} }
} }
}; };
}; };
}) })
.catch(error => { .catch(error => {
console.error('Error during service worker registration:', error); console.error('Error during service worker registration:', error);
}); });
} }
function checkValidServiceWorker(swUrl) { function checkValidServiceWorker(swUrl) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then(response => { .then(response => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === 404 || response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1 response.headers.get('content-type').indexOf('javascript') === -1
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload(); window.location.reload();
}); });
}); });
} else { } else {
// Service worker found. Proceed as normal. // Service worker found. Proceed as normal.
registerValidSW(swUrl); registerValidSW(swUrl);
} }
}) })
.catch(() => { .catch(() => {
console.log( console.log(
'No internet connection found. App is running in offline mode.' 'No internet connection found. App is running in offline mode.'
); );
}); });
} }
export function unregister() { export function unregister() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then(registration => {
registration.unregister(); registration.unregister();
}); });
} }
} }

View File

@ -1,44 +1,44 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Website.Controllers namespace Website.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
public class SampleDataController : Controller public class SampleDataController : Controller
{ {
private static string[] Summaries = new[] private static string[] Summaries = new[]
{ {
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
}; };
[HttpGet("[action]")] [HttpGet("[action]")]
public IEnumerable<WeatherForecast> WeatherForecasts() public IEnumerable<WeatherForecast> WeatherForecasts()
{ {
var rng = new Random(); var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{ {
DateFormatted = DateTime.Now.AddDays(index).ToString("d"), DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
TemperatureC = rng.Next(-20, 55), TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)] Summary = Summaries[rng.Next(Summaries.Length)]
}); });
} }
public class WeatherForecast public class WeatherForecast
{ {
public string DateFormatted { get; set; } public string DateFormatted { get; set; }
public int TemperatureC { get; set; } public int TemperatureC { get; set; }
public string Summary { get; set; } public string Summary { get; set; }
public int TemperatureF public int TemperatureF
{ {
get get
{ {
return 32 + (int)(TemperatureC / 0.5556); return 32 + (int)(TemperatureC / 0.5556);
} }
} }
} }
} }
} }

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Website.Managers
{
public class PasswordManager
{
private int saltLengthLimit = 32;
public byte[] GetSalt()
{
return GetSalt(saltLengthLimit);
}
public byte[] GetSalt(int maximumSaltLength)
{
var salt = new byte[maximumSaltLength];
using (var random = new RNGCryptoServiceProvider())
{
random.GetNonZeroBytes(salt);
}
return salt;
}
public byte[] Hash(string value, byte[] salt)
{
return Hash(Encoding.UTF8.GetBytes(value), salt);
}
public byte[] Hash(byte[] value, byte[] salt)
{
byte[] saltedValue = value.Concat(salt).ToArray();
return new SHA256Managed().ComputeHash(saltedValue);
}
public bool ConfirmPassword(string password, byte[] salt, byte[] passwordhash)
{
byte[] passwordHash = Hash(password, salt);
return passwordhash.SequenceEqual(passwordHash);
}
}
}

View File

@ -0,0 +1,134 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Website.Models;
namespace Website.Managers
{
public class UserManager
{
private readonly string SuperAdminToken = "jklqwufl8uq0qqjwvpioOP*U&Q@(JDJAHUIALDIWaklshfagejhakdfhlae";
private readonly LedenDatabase _db;
private readonly PasswordManager _pw;
public UserManager(LedenDatabase context)
{
_db = context;
_pw = new PasswordManager();
}
public Token LoginUser(string email, string password)
{
var z = _db.members.Where(d => d.Email == email);
if (z.Any())
{
var x = z.First();
if (_pw.ConfirmPassword(password, Array.ConvertAll(x.PasswordSalt, c => (byte)c), Array.ConvertAll(x.PasswordHash, c => (byte)c)))// Array.ConvertAll(x.PasswordSalt, c => (int)c), Array.ConvertAll(x.PasswordHash, c => (int)c)))
{
if (x.Tokens.Any())
{
x.Tokens = x.Tokens.Where(d => d.Expiration > DateTime.UtcNow).ToList();
}
Token token = new Token()
{
Expiration = DateTime.UtcNow.AddDays(7),
ServiceName = "CSFR Ichthus",
Session = Guid.NewGuid(),
Permissions = new TokenPermissions()
{
ViewData = true,
ViewEmail = true,
ViewName = true
}
};
//add token to database before returning it.
x.Tokens.Add(token);
_db.members.Update(x);
_db.SaveChanges();
return token;
}
}
return null;
}
public Token AddUser(API_MemberRegisterData user, string token)
{
if(token != SuperAdminToken) { return null; }
if (_db.members.Where(d => d.Email == user.Email).Any())
{
return null;
}
Member mem = new Member()
{
Firstname = user.Firstname,
Lastname = user.Lastname,
Dispuutsleeftijd = user.Dispuutsleeftijd,
UserID = Guid.NewGuid().ToString().Replace("-", ""),
Email = user.Email,
Geslacht = user.Geslacht
};
byte[] salt = _pw.GetSalt();
mem.PasswordHash = Array.ConvertAll(_pw.Hash(user.Password, salt), c => (int)c);//Encoding.ASCII.GetString(Hash(user.Password, salt));
mem.PasswordSalt = Array.ConvertAll(salt, c => (int)c);//Encoding.ASCII.GetString(salt);
_db.members.Add(mem);
_db.SaveChanges();
return LoginUser(user.Email, user.Password);
}
private bool ValidSession(string userid, string session, string action = "Login")
{
var x = _db.members.Where(d => d.UserID == userid).First();
if (x != null)
{
if (x.Tokens.Any())
{
//get all tokens that are from the future
x.Tokens = x.Tokens.Where(d => d.Expiration > DateTime.UtcNow).ToList();
//update all tokens so the old ones get removed
_db.members.Update(x);
Token token = x.Tokens.Where(d => d.Session.ToString() == session).First();
if (token != null)
{
switch (action)
{
case "Login":
return true;
case "ChangePassword":
return token.Permissions.ChangePassword;
case "ViewData":
return token.Permissions.ViewData;
}
}
}
}
return false;
}
public API_MemberData GetMemberInfo(string userid, string session)
{
if (ValidSession(userid, session, "ViewData"))
{
var member = _db.members.Where(d => d.UserID == userid).First();
API_MemberData retval = new API_MemberData()
{
ContactEmail = member.Email,
Dispuutsleeftijd = member.Dispuutsleeftijd,
Leeftijd = member.Leeftijd,
Geslacht = member.Geslacht,
StudieInfo = member.StudieInfo,
Firstname = member.Firstname,
Lastname = member.Lastname,
Rechten = member.Rechten,
Tokens = member.Tokens,
OudLid = member.OudLid
};
return retval;
}
else
{
return null;
}
}
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Website.Models
{
public class API_MemberRegisterData
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public int Dispuutsleeftijd { get; set; } = 1;
public string Password { get; set; }
public string Email { get; set; }
public Sex Geslacht { get; set; } = 0;
}
public class API_MemberData
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public List<Token> Tokens { get; set; } = new List<Token>();
public int Leeftijd { get; set; }
public int Dispuutsleeftijd { get; set; }
public string ContactEmail { get; set; }
public StudieInfo StudieInfo { get; set; }
public Sex Geslacht { get; set; }
public Rechten Rechten { get; set; } = 0;
public bool OudLid { get; set; } = false;
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Website.Models
{
public class Commissie
{
public int ID { get; set; }
public string Description { get; set; }
public List<int> Members { get; set; } = new List<int>();
public int CommissiePreases { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace Website.Models
{
public class LedenDatabase : DbContext
{
public LedenDatabase(DbContextOptions<LedenDatabase> options) : base(options) { }
public DbSet<Member> members { get; set; }
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Website.Models
{
public class Member
{
public int ID { get; set; }
public string UserID { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public List<Token> Tokens { get; set; } = new List<Token>();
public int Leeftijd { get; set; }
public int Dispuutsleeftijd { get; set; }
public string Opmerking { get; set; }
//Credentials
public string Email { get; set; }
public int[] PasswordHash { get; set; }
public int[] PasswordSalt { get; set; }
//End Credentials
public StudieInfo StudieInfo { get; set; }
public Sex Geslacht { get; set; }
public Rechten Rechten { get; set; } = 0;
public DateTime Verjaardag { get; set; }
public bool OudLid { get; set; } = false;
}
public enum Sex
{
Man = 0,
Vrouw = 1
}
public enum Rechten
{
Gebruiker = 0,
Moderator = 1,
Admin = 2
}
public class StudieInfo
{
public int ID { get; set; }
public string StudieNaam { get; set; }
public string StudieOmschrijving { get; set; }
public int StudieJaar { get; set; }
public string Opmerking { get; set; }
}
public class Token
{
public int ID { get; set; }
public Guid Session { get; set; }
public string ServiceName { get; set; }
public DateTime Expiration { get; set; }
public TokenPermissions Permissions { get; set; }
}
public class TokenPermissions
{
public int ID { get; set; }
public bool ViewName { get; set; } = true; //first and last name
public bool ViewEmail { get; set; } = false; //email address
public bool ViewData { get; set; } = false; //age, dispuut age, address etc.
public bool ChangePassword { get; set; } = false;
}
}

View File

@ -1,23 +1,23 @@
@page @page
@model ErrorModel @model ErrorModel
@{ @{
ViewData["Title"] = "Error"; ViewData["Title"] = "Error";
} }
<h1 class="text-danger">Error.</h1> <h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2> <h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId) @if (Model.ShowRequestId)
{ {
<p> <p>
<strong>Request ID:</strong> <code>@Model.RequestId</code> <strong>Request ID:</strong> <code>@Model.RequestId</code>
</p> </p>
} }
<h3>Development Mode</h3> <h3>Development Mode</h3>
<p> <p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred. Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p> </p>
<p> <p>
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application. <strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
</p> </p>

View File

@ -1,23 +1,23 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Website.Pages namespace Website.Pages
{ {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel public class ErrorModel : PageModel
{ {
public string RequestId { get; set; } public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet() public void OnGet()
{ {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
} }
} }
} }

View File

@ -1,3 +1,3 @@
@using Website @using Website
@namespace Website.Pages @namespace Website.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -1,24 +1,24 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Website namespace Website
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
CreateWebHostBuilder(args).Build().Run(); CreateWebHostBuilder(args).Build().Run();
} }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>(); .UseStartup<Startup>();
} }
} }

View File

@ -1,67 +1,74 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
namespace Website using Microsoft.EntityFrameworkCore;
{ using Website.Models;
public class Startup
{ namespace Website
public Startup(IConfiguration configuration) {
{ public class Startup
Configuration = configuration; {
} public Startup(IConfiguration configuration)
{
public IConfiguration Configuration { get; } Configuration = configuration;
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public IConfiguration Configuration { get; }
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
// In production, the React files will be served from this directory {
services.AddSpaStaticFiles(configuration => services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
{
configuration.RootPath = "ClientApp/build"; //Add database
}); services.AddDbContext<LedenDatabase>(options => options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // In production, the React files will be served from this directory
public void Configure(IApplicationBuilder app, IHostingEnvironment env) services.AddSpaStaticFiles(configuration =>
{ {
if (env.IsDevelopment()) configuration.RootPath = "ClientApp/build";
{ });
app.UseDeveloperExceptionPage(); }
}
else // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
{ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
app.UseExceptionHandler("/Error"); {
app.UseHsts(); if (env.IsDevelopment())
} {
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection(); }
app.UseStaticFiles(); else
app.UseSpaStaticFiles(); {
app.UseExceptionHandler("/Error");
app.UseMvc(routes => app.UseHsts();
{ }
routes.MapRoute(
name: "default", app.UseHttpsRedirection();
template: "{controller}/{action=Index}/{id?}"); app.UseStaticFiles();
}); app.UseSpaStaticFiles();
app.UseSpa(spa => app.UseMvc(routes =>
{ {
spa.Options.SourcePath = "ClientApp"; routes.MapRoute(
name: "default",
if (env.IsDevelopment()) template: "{controller}/{action=Index}/{id?}");
{ });
spa.UseReactDevelopmentServer(npmScript: "start");
} app.UseSpa(spa =>
}); {
} spa.Options.SourcePath = "ClientApp";
}
} if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
});
}
}
}

View File

@ -1,49 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion> <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot> <SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes> <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.1" />
</ItemGroup> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list --> <ItemGroup>
<Content Remove="$(SpaRoot)**" /> <!-- Don't publish the SPA source files, but do show them in the project files list -->
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" /> <Content Remove="$(SpaRoot)**" />
</ItemGroup> <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed --> <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<Exec Command="node --version" ContinueOnError="true"> <!-- Ensure Node.js is installed -->
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" /> <Exec Command="node --version" ContinueOnError="true">
</Exec> <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." /> </Exec>
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." /> <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
</Target> <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode --> <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" /> <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />
<!-- Include the newly-built files in the publish output -->
<ItemGroup> <!-- Include the newly-built files in the publish output -->
<DistFiles Include="$(SpaRoot)build\**" /> <ItemGroup>
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)"> <DistFiles Include="$(SpaRoot)build\**" />
<RelativePath>%(DistFiles.Identity)</RelativePath> <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <RelativePath>%(DistFiles.Identity)</RelativePath>
</ResolvedFileToPublish> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ItemGroup> </ResolvedFileToPublish>
</Target> </ItemGroup>
</Target>
</Project>
</Project>

View File

@ -1,9 +1,9 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Debug",
"System": "Information", "System": "Information",
"Microsoft": "Information" "Microsoft": "Information"
} }
} }
} }

View File

@ -1,8 +1,11 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Warning" "Default": "Warning"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
} "ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=5432;Database=Website_Ichthus;User Id=postgres;Password=password;"
}
}