Skip to content
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"react-scripts": "1.0.7"
},
"scripts": {
"express": "node ./src/server/server.js",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js express",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"start-js": "react-scripts start",
"build-css": "node-sass-chokidar src/client/styles/sass -o src/client/styles/",
"watch-css": "npm run build-css && node-sass-chokidar src/client/styles/sass -o src/client/styles/ --watch --recursive",
"express": "node ./src/server/server.js"
"watch-css": "npm run build-css && node-sass-chokidar src/client/styles/sass -o src/client/styles/ --watch --recursive"
}
}
178 changes: 178 additions & 0 deletions public/LetsCode2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/client/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import {BrowserRouter as Router, Route, Switch} from 'react-router-dom'
import { Router, Route, Switch} from 'react-router-dom'
import {createBrowserHistory} from 'history'
import './App.css';
import registerServiceWorker from './registerServiceWorker'
Expand Down
31 changes: 19 additions & 12 deletions src/client/components/Auth/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LoginForm extends Component {
this.handlePasswordChange = this.handlePasswordChange.bind(this);
}

handleEmailChange (evt) {
handleEmailChange(evt) {
this.setState({
user: evt.target.value
});
Expand All @@ -43,32 +43,38 @@ class LoginForm extends Component {
password: this.state.password
})
.done((data) => {
localStorage.setItem("odslearncode", data.token);
window.location.replace('/dashboard');
})
localStorage.setItem("odslearncode", data.token);
window.location.replace('/dashboard');
})
.fail(
this.show('blurring')
);
}

show = (dimmer) => () => this.setState({ dimmer, open: true })
close = () => this.setState({ open: false, requestActive: false })
show = (dimmer) => () => this.setState({dimmer, open: true})
close = () => this.setState({open: false, requestActive: false})

render() {
const { open, dimmer } = this.state
const {open, dimmer} = this.state
// Hide overflow of body
document.getElementsByTagName('body')[0].style.overflow = 'hidden'
return (
<div className="loginComponent">
<div className="loginFormBar">
<Dimmer active={this.state.requestActive}>
<Loader />
<Loader/>
</Dimmer>
<Form className="loginForm">
<img src="./LetsCode2.svg"/>

<h2>Sign in</h2>
<Form.Input id="emailInput" label='E-Mail' type="email" placeholder='your.name@mail.com' onChange={this.handleEmailChange} required autoFocus/>
<Form.Input label='Enter Password' type='password' placeholder='s3cur3Pa55w0rd' onChange={this.handlePasswordChange} required/>
<Button type='submit' onClick={this.login.bind(this)}>Login</Button><Link to="/" id="forgotPassword">Forgot Password?</Link>
<Form.Input id="emailInput" label='E-Mail' type="email" placeholder='your.name@mail.com'
onChange={this.handleEmailChange} required autoFocus/>
<Form.Input label='Enter Password' type='password' placeholder='s3cur3Pa55w0rd'
onChange={this.handlePasswordChange} required/>
<Button type='submit' onClick={this.login.bind(this)}>Login</Button><Link to="/"
id="forgotPassword">Forgot
Password?</Link>
</Form>
<h2>Not registered?</h2>
<Button onClick={this.props.onClick}>Sign Up</Button>
Expand All @@ -82,7 +88,8 @@ class LoginForm extends Component {
</Modal.Description>
</Modal.Content>
<Modal.Actions>
<Button positive icon='checkmark' labelPosition='right' content="Try again" onClick={this.close} />
<Button positive icon='checkmark' labelPosition='right' content="Try again"
onClick={this.close}/>
</Modal.Actions>
</Modal>
</div>
Expand Down
Loading