hedgedoc/src/lib/web
Dexter Chua e45327df5d Allow for undefined email and displayName
OAuth2 allows the user to only consent to a subset of the scopes
requested. Previously, the Generic Oauth2 implementation assumes that
the `username`, `email` and `displayName` attributes are supplied, and
may crash if they are not defined.

This commit allows for `email` and `displayName` to not be defined,
either through the user refusing consent or the OAuth2 configuration
not asking for them in the first place (by not setting
`userProfile*Attr`).

If `email` is not provided, the `emails` property is simply left empty.
If `displayName` is not provided, it is left undefined, and CodiMD uses
the `username` whenever the `displayName` is expected.

This does not deal with the case where `username` is not provided. Since
usernames are not unique in CodiMD, it is possible to deal with this by
setting a dummy username. This can be added in a future commit if
desired.

Fixes #406

Signed-off-by: Dexter Chua <dalcde@yahoo.com.hk>
2020-06-22 23:09:35 +08:00
..
auth Allow for undefined email and displayName 2020-06-22 23:09:35 +08:00
imageRouter Move src/lib/utils.ts to src/lib/utils/functions.ts 2020-06-12 22:15:04 +02:00
middleware Move lib and test into src directory 2020-05-22 14:19:05 +02:00
note Separate User and PhotoProfile classes into their own files 2020-06-12 22:10:57 +02:00
baseRouter.ts Move lib and test into src directory 2020-05-22 14:19:05 +02:00
historyRouter.ts Move lib and test into src directory 2020-05-22 14:19:05 +02:00
index.ts Move lib and test into src directory 2020-05-22 14:19:05 +02:00
statusRouter.ts Move lib and test into src directory 2020-05-22 14:19:05 +02:00
userRouter.ts Separate User and PhotoProfile classes into their own files 2020-06-12 22:10:57 +02:00
utils.ts Move lib and test into src directory 2020-05-22 14:19:05 +02:00