Added login stuff
This commit is contained in:
parent
b67195ae56
commit
72f849ef89
1284
Website/Website/ClientApp/package-lock.json
generated
1284
Website/Website/ClientApp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "^3.4.1",
|
"bootstrap": "^3.4.1",
|
||||||
|
"js-cookie": "^2.2.1",
|
||||||
"react": "^16.0.0",
|
"react": "^16.0.0",
|
||||||
"react-bootstrap": "^0.31.5",
|
"react-bootstrap": "^0.31.5",
|
||||||
"react-dom": "^16.0.0",
|
"react-dom": "^16.0.0",
|
||||||
|
@ -2,6 +2,9 @@ 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';
|
||||||
|
import { OverIchthus } from './components/OverIchthus';
|
||||||
|
import { Login } from './components/Login';
|
||||||
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
displayName = App.name
|
displayName = App.name
|
||||||
@ -10,6 +13,9 @@ export default class App extends Component {
|
|||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<Route exact path='/' component={Home} />
|
<Route exact path='/' component={Home} />
|
||||||
|
<Route exact path='/leden' component={Leden} />
|
||||||
|
<Route exact path='/overichthus' component={OverIchthus} />
|
||||||
|
<Route exact path='/login' component={Login} />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
0
Website/Website/ClientApp/src/Utils/CookieUtils.js
Normal file
0
Website/Website/ClientApp/src/Utils/CookieUtils.js
Normal file
@ -6,7 +6,7 @@ export class Home extends Component {
|
|||||||
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>
|
||||||
);
|
);
|
||||||
|
@ -7,7 +7,12 @@ export class Layout extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
<NavMenu />
|
<NavMenu />
|
||||||
|
<div>
|
||||||
|
{this.props.children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
Website/Website/ClientApp/src/components/Leden.css
Normal file
29
Website/Website/ClientApp/src/components/Leden.css
Normal 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;
|
||||||
|
}
|
52
Website/Website/ClientApp/src/components/Leden.js
Normal file
52
Website/Website/ClientApp/src/components/Leden.js
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
Website/Website/ClientApp/src/components/Login.js
Normal file
21
Website/Website/ClientApp/src/components/Login.js
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
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 {
|
||||||
@ -18,7 +18,7 @@ export class NavMenu extends Component {
|
|||||||
|
|
||||||
{/* 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>
|
||||||
@ -39,7 +39,6 @@ export class NavMenu extends Component {
|
|||||||
<Link to={`/overichthus/`} id="MenuText">
|
<Link to={`/overichthus/`} id="MenuText">
|
||||||
Over Ichthus
|
Over Ichthus
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
15
Website/Website/ClientApp/src/components/OverIchthus.js
Normal file
15
Website/Website/ClientApp/src/components/OverIchthus.js
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
42
Website/Website/Managers/PasswordManager.cs
Normal file
42
Website/Website/Managers/PasswordManager.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
134
Website/Website/Managers/UserManager.cs
Normal file
134
Website/Website/Managers/UserManager.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
Website/Website/Models/API_Member.cs
Normal file
31
Website/Website/Models/API_Member.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
15
Website/Website/Models/Commissie.cs
Normal file
15
Website/Website/Models/Commissie.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
15
Website/Website/Models/Database.cs
Normal file
15
Website/Website/Models/Database.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
71
Website/Website/Models/Member.cs
Normal file
71
Website/Website/Models/Member.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,9 @@ 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;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Website.Models;
|
||||||
|
|
||||||
namespace Website
|
namespace Website
|
||||||
{
|
{
|
||||||
@ -22,6 +25,10 @@ namespace Website
|
|||||||
{
|
{
|
||||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||||
|
|
||||||
|
//Add database
|
||||||
|
services.AddDbContext<LedenDatabase>(options => options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));
|
||||||
|
|
||||||
|
|
||||||
// In production, the React files will be served from this directory
|
// In production, the React files will be served from this directory
|
||||||
services.AddSpaStaticFiles(configuration =>
|
services.AddSpaStaticFiles(configuration =>
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
<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" />
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -4,5 +4,8 @@
|
|||||||
"Default": "Warning"
|
"Default": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Server=localhost;Port=5432;Database=Website_Ichthus;User Id=postgres;Password=password;"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user