Skip to content

Commit

Permalink
Fix login and register form (#183)
Browse files Browse the repository at this point in the history
* Insert form tag in register and login pages

By using this tag, spaces between each inputbase were removed so I decided to use <br />s to make the design cleaner. Also, there were some changes made to the db and to the prettier packages, but I'm not sure if they should be kept or not.

* Add Enter feature for registration form and autoComplete types specified for better recognition by personal information storing software

* Data removed and added to gitignore

* Correct gitignore issue
  • Loading branch information
afonsofsdomingues authored May 27, 2022
1 parent 9acc8bc commit c676b3e
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 70 deletions.
2 changes: 1 addition & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
2 changes: 1 addition & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"trailingComma": "es5",
"useTabs": true,
"endOfLine":"auto"
}
}
12 changes: 8 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.29.4",
"jquery": "^3.6.0",
"md5": "^2.3.0",
"notistack": "^2.0.3",
"prettier": "^2.6.2",
"react": "^17.0.2",
"react-countdown": "^2.3.2",
"react-dom": "^17.0.2",
Expand Down Expand Up @@ -60,6 +58,8 @@
]
},
"devDependencies": {
"eslint-plugin-prettier": "^4.0.0"
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "2.6.2"
}
}
50 changes: 28 additions & 22 deletions frontend/src/components/login/LoginInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,34 @@ const LoginInput = () => {
direction='column'
justifyContent='center'
>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
margin='dense'
variant='outlined'
placeholder='Nome de utilizador'
onChange={handleChangeUsername}
onKeyUp={handleKeyPress}
/>
</Grid>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Password'
type='password'
onChange={handleChangePassword}
onKeyUp={handleKeyPress}
/>
</Grid>
<form>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
margin='dense'
variant='outlined'
placeholder='Nome de utilizador'
autoComplete='username'
onChange={handleChangeUsername}
onKeyUp={handleKeyPress}
/>
</Grid>
<br />
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Password'
type='password'
autoComplete='password'
onChange={handleChangePassword}
onKeyUp={handleKeyPress}
/>
</Grid>
<br />
</form>
<Grid item style={{ marginTop: '4rem' }}>
<NormalButton fontSize={45} text='Entrar' onClick={handleClick} />
</Grid>
Expand Down
97 changes: 58 additions & 39 deletions frontend/src/components/register/RegisterInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ const RegisterInput = () => {
}
};

const handleKeyPress = (e) => {
if (e.keyCode === 13) {
handleClick();
}
};

if (codePhase) return <CodeInput username={username} password={pass1} />;

return (
Expand All @@ -143,45 +149,58 @@ const RegisterInput = () => {
<Logo className={classes.logo} />
</Grid>
<Grid className={classes.containerForm} container spacing={4} direction='column'>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
margin='dense'
variant='outlined'
placeholder='Nome de utilizador'
onChange={handleChangeUsername}
/>
</Grid>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='E-mail'
onChange={handleChangeEmail}
/>
</Grid>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Password'
type='password'
onChange={handleChangePass1}
/>
</Grid>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Repete a password'
type='password'
onChange={handleChangePass2}
/>
</Grid>
<form>
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
margin='dense'
variant='outlined'
placeholder='Nome de utilizador'
autoComplete='username'
onChange={handleChangeUsername}
onKeyUp={handleKeyPress}
/>
</Grid>
<br />
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='E-mail'
autoComplete='email'
onChange={handleChangeEmail}
onKeyUp={handleKeyPress}
/>
</Grid>
<br />
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Password'
type='password'
autoComplete='password'
onChange={handleChangePass1}
onKeyUp={handleKeyPress}
/>
</Grid>
<br />
<Grid item>
<InputBase
className={classes.input}
inputProps={{ style: { margin: '0 1rem 0 1rem', fontSize: 26 } }}
variant='outlined'
placeholder='Repete a password'
type='password'
autoComplete='password'
onChange={handleChangePass2}
onKeyUp={handleKeyPress}
/>
</Grid>
</form>
<Grid item style={{ marginTop: '4rem' }}>
<NormalButton fontSize={45} text='Registar' onClick={handleClick} />
</Grid>
Expand Down

0 comments on commit c676b3e

Please sign in to comment.