diff --git a/backend/routes/auth.js b/backend/routes/auth.js index f3bba0603d2cd1209a447c2a84b74bbba4091c8f..a06a5378a500438dbe38e25812074aa42d2043d2 100644 --- a/backend/routes/auth.js +++ b/backend/routes/auth.js @@ -105,6 +105,7 @@ router.post('/me/update', passport.authenticate('jwt', {session: false}), async const date_birth = req.body.date_birth; const oldPassword = req.body.oldpassword; const newPassword = req.body.password; + const newPicture= req.body.picture; if (!firstname && !lastname && !email && !date_birth && !passport) return res.status(200); @@ -135,6 +136,8 @@ router.post('/me/update', passport.authenticate('jwt', {session: false}), async dbUser.email = email; if (date_birth) dbUser.date_birth = date_birth; + if (newPicture) + dbUser.picture = newPicture; try { await dbUser.save(); diff --git a/frontend/src/containers/Profile.container.js b/frontend/src/containers/Profile.container.js index 18bd3691105ca5269c18ff7cdaf04203f50c0a8e..9b935206671e83c78d17b0ba22cefd3550400a4e 100644 --- a/frontend/src/containers/Profile.container.js +++ b/frontend/src/containers/Profile.container.js @@ -150,6 +150,15 @@ export class Profile extends React.Component { /> </Form.Group> } + <Form.Group controlId="picture"> + <Form.Label>Avatar</Form.Label> + <Form.Control + defaultValue={this.props.state.me.picture} + onChange={this.handleChange} + type="text" + readOnly={this.state.readOnly} + /> + </Form.Group> { !this.state.readOnly && <Button block