Browse Source

Added Login

master
Rino Grupp 4 years ago
parent
commit
095ba71744
14 changed files with 87 additions and 73 deletions
  1. +20
    -56
      package-lock.json
  2. +1
    -0
      package.json
  3. BIN
      public/icons/dontcare.png
  4. BIN
      public/icons/scooter_electric.png
  5. BIN
      public/icons/scooter_manual.jpg
  6. BIN
      public/icons/scooter_manual.png
  7. BIN
      public/icons/size_01.png
  8. BIN
      public/icons/size_02.png
  9. BIN
      public/icons/size_03.png
  10. +2
    -1
      src/App.js
  11. +37
    -4
      src/components/create/Create.js
  12. +1
    -5
      src/components/finder/Scooter.js
  13. +26
    -6
      src/components/finder/Step.js
  14. +0
    -1
      src/components/other/Impressum.js

+ 20
- 56
package-lock.json View File

@ -2767,8 +2767,7 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"optional": true
"bundled": true
},
"aproba": {
"version": "1.2.0",
@ -2786,13 +2785,11 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"optional": true
"bundled": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -2805,18 +2802,15 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
@ -2919,8 +2913,7 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"optional": true
"bundled": true
},
"ini": {
"version": "1.3.5",
@ -2930,7 +2923,6 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -2943,20 +2935,17 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"optional": true
"bundled": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -2973,7 +2962,6 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -3046,8 +3034,7 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"object-assign": {
"version": "4.1.1",
@ -3057,7 +3044,6 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -3133,8 +3119,7 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"optional": true
"bundled": true
},
"safer-buffer": {
"version": "2.1.2",
@ -3164,7 +3149,6 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -3182,7 +3166,6 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -3221,13 +3204,11 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"optional": true
"bundled": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"optional": true
"bundled": true
}
}
},
@ -6821,8 +6802,7 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"optional": true
"bundled": true
},
"aproba": {
"version": "1.2.0",
@ -6846,7 +6826,6 @@
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -6859,8 +6838,7 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"concat-map": {
"version": "0.0.1",
@ -6869,8 +6847,7 @@
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
@ -6973,8 +6950,7 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"optional": true
"bundled": true
},
"ini": {
"version": "1.3.5",
@ -6984,7 +6960,6 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -6997,20 +6972,17 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"optional": true
"bundled": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -7027,7 +6999,6 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -7100,8 +7071,7 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"object-assign": {
"version": "4.1.1",
@ -7111,7 +7081,6 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -7187,8 +7156,7 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"optional": true
"bundled": true
},
"safer-buffer": {
"version": "2.1.2",
@ -7218,7 +7186,6 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -7236,7 +7203,6 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -7275,13 +7241,11 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"optional": true
"bundled": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"optional": true
"bundled": true
}
}
}

+ 1
- 0
package.json View File

@ -9,6 +9,7 @@
"axios": "^0.18.0",
"bootstrap": "^4.3.1",
"classnames": "^2.2.6",
"hash.js": "^1.1.7",
"material-design-icons": "^3.0.1",
"prop-types": "^15.7.2",
"react": "^16.8.6",

BIN
public/icons/dontcare.png View File

Before After
Width: 2000  |  Height: 2000  |  Size: 26 KiB

BIN
public/icons/scooter_electric.png View File

Before After
Width: 858  |  Height: 858  |  Size: 64 KiB

BIN
public/icons/scooter_manual.jpg View File

Before After
Width: 858  |  Height: 858  |  Size: 40 KiB

BIN
public/icons/scooter_manual.png View File

Before After
Width: 858  |  Height: 858  |  Size: 37 KiB

BIN
public/icons/size_01.png View File

Before After
Width: 512  |  Height: 512  |  Size: 2.1 KiB Width: 512  |  Height: 512  |  Size: 2.1 KiB

BIN
public/icons/size_02.png View File

Before After
Width: 512  |  Height: 512  |  Size: 2.2 KiB Width: 512  |  Height: 512  |  Size: 2.2 KiB

BIN
public/icons/size_03.png View File

Before After
Width: 512  |  Height: 512  |  Size: 2.2 KiB Width: 512  |  Height: 512  |  Size: 2.2 KiB

+ 2
- 1
src/App.js View File

@ -108,7 +108,7 @@ class App extends React.Component{
Scooter-Finder - Ein Projekt von Studenten der Hochschule Biberach
</Typography>
<Link href={"https://scooter.grupp.cc"}>
<Link href={"https://scooter-finder.de"}>
<ColorButton variant="outlined">
Zur Homepage
</ColorButton>
@ -127,6 +127,7 @@ class App extends React.Component{
<AppBar position="fixed" color="primary" className={classes.appBar}>
<Toolbar>
<Link href={"/"} className={classes.link}>PLEV</Link>
<Link href={"/impressum"} className={classes.link}>Impressum</Link>
<Link href={"/admin"} className={classes.link}>Admin</Link>

+ 37
- 4
src/components/create/Create.js View File

@ -22,15 +22,14 @@ import InputLabel from '@material-ui/core/InputLabel';
import MenuItem from '@material-ui/core/MenuItem';
import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
import OutlinedInput from '@material-ui/core/OutlinedInput';
var sha512 = require('hash.js/lib/hash/sha/512');
const hash = 'edda65dbb3658c0dfe65b8a419dbee5c19c5d81cd92b31fc499ddaeff293cee83f74e3882f33713b7c3748349f51bb84da33f1896827b1a576ad65ebcb48d341'
const Transition = React.forwardRef(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
});
const styles = theme => ({
container: {
display: 'flex',
@ -153,6 +152,8 @@ class Create extends React.Component {
technicalOpen: false,
dialogUploaded: false,
image: false,
login: true,
password: "",
}
setStates = () => {
@ -218,6 +219,10 @@ class Create extends React.Component {
this.setState({[key]: true})
}
handleLoginClose = () => {
}
handleDialogOpen = (error) => {
this.setState({ dialogOpen: true, dialogMessage: error });
};
@ -688,6 +693,33 @@ class Create extends React.Component {
)
}
handlePassword = event => {
this.setState({password: event.target.value})
}
createLoginDialog(){
return (
<Dialog open={this.state.login} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Login</DialogTitle>
<DialogContent>
<DialogContentText>
Melde dich an um Scooter anlegen zu können
</DialogContentText>
<TextField
value={this.state.password}
autoFocus
margin="dense"
id="name"
label="Passwort"
type="password"
fullWidth
onChange={this.handlePassword}
/>
</DialogContent>
</Dialog>
)
}
render(){
const { classes } = this.props;
return(
@ -711,6 +743,7 @@ class Create extends React.Component {
{this.createChipDialog('vorteile')}
{this.createChipDialog('nachteile')}
{this.createDoneDialog()}
{sha512().update(this.state.password).digest('hex')!==hash ? this.createLoginDialog(): undefined}
</div>
)
}

+ 1
- 5
src/components/finder/Scooter.js View File

@ -9,7 +9,6 @@ import CardActions from '@material-ui/core/CardActions';
import IconButton from '@material-ui/core/IconButton';
import Collapse from '@material-ui/core/Collapse';
import Button from '@material-ui/core/Button';
import classnames from 'classnames';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import CloseIcon from '@material-ui/icons/Close'
import CheckIcon from '@material-ui/icons/Check'
@ -244,16 +243,13 @@ class Scooter extends React.Component {
</Grid>
<Grid item xs={12}>
<CardActions className={classes.actions} disableActionSpacing onClick={this.handleExpandClick}>
<IconButton
className={classes.expand}
aria-expanded={this.state.expanded}
aria-label="Show more"
>
<Typography variant="button" className={classes.mehrInfos}>Mehr Infos</Typography>
<ExpandMoreIcon className={
{[classes.expandOpen]: this.state.expanded}
}/>
<ExpandMoreIcon className={{[classes.expandOpen]: this.state.expanded}}/>
</IconButton>
</CardActions>
</Grid>

+ 26
- 6
src/components/finder/Step.js View File

@ -84,6 +84,12 @@ const styles = theme => ({
marginLeft: '20%',
marginRight: '20%'
},
hidden: {
visibility: 'hidden'
},
iconButton: {
height: 'auto !important'
}
});
const backup = {
@ -284,7 +290,15 @@ class Step extends React.Component {
<Grid item key={index}>
<Grid container direction="column" alignItems="center">
<Grid item>
<Button className={classes.button} variant="contained" color="primary" key={index} onClick={() => {this.handleButton(options)}}><img src={"..\\..\\..\\icons\\"+options.icon} className={classes.iconImage}></img></Button>
<Button
className={classes.button}
variant="contained"
color="primary"
key={index}
onClick={() => {this.handleButton(options)}}
>
<img src={"..\\..\\..\\icons\\"+options.icon} className={classes.iconImage} alt={"icon "+options.icon}></img>
</Button>
</Grid>
<Grid>
<Typography variant="button" className={classes.description} onClick={() => {this.handleButton(options)}}>{options.text}</Typography>
@ -300,10 +314,16 @@ class Step extends React.Component {
return (
<Grid item className={classes.button} key={index}>
<Grid container direction="column" alignItems="center">
<Grid item>
<IconButton classes={{ selected: classes.selected }} variant="outlined" color="inherit" key={index} value="asdf" selected={toggleState}
onClick={() => {this.handleToggle(options.text, options.result)}}><img src={"..\\..\\..\\icons\\"+options.icon} className={classes.iconImage}>
</img>
<Grid item className={options.icon==="none"? classes.hidden : undefined}>
<IconButton
classes={{ selected: classes.selected }}
className={classes.iconButton}
key={index}
value="asdf"
selected={toggleState}
onClick={() => {this.handleToggle(options.text, options.result)}}
>
<img src={"..\\..\\..\\icons\\"+options.icon} className={classes.iconImage} alt={"icon "+options.icon}></img>
</IconButton>
</Grid>
<Grid item>
@ -354,7 +374,7 @@ class Step extends React.Component {
return(
<div>
<Grid container justify="center" alignItems="center" direction="column" >
<Grid item xs={12} className={classes.space}><img src="..\..\..\images\plev_logo.jpg" className={classes.image}></img></Grid>
<Grid item xs={12} className={classes.space}><img src="..\..\..\images\plev_logo.jpg" className={classes.image} alt="plev-logo"></img></Grid>
<Grid item xs={12} className={classes.center}>
<Startpage />
</Grid>

+ 0
- 1
src/components/other/Impressum.js View File

@ -10,7 +10,6 @@ const styles = theme => ({
marginBottom: "3em",
textAlign: 'center',
marginTop: '1em',
marginBottom: '1em',
borderWidth: '2px',
borderStyle: 'solid',
borderColor: '#fff',

Loading…
Cancel
Save