mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00
Move profile-related functions into PhotoProfile
The previous Profile type was renamed to PassportProfile, as it is only used for profile-information from Passport plugins. All functions relating to profile-parsing are now encapsulated in the PhotoProfile class (naming still debatable). Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
4552085ae0
commit
4e7c82dc3b
5 changed files with 84 additions and 92 deletions
|
@ -1,6 +1,6 @@
|
|||
import { InternalOAuthError, Strategy as OAuth2Strategy } from 'passport-oauth2'
|
||||
import { config } from '../../../config'
|
||||
import { Profile, ProviderEnum } from '../../../models/user'
|
||||
import { PassportProfile, ProviderEnum } from '../../../models/user'
|
||||
|
||||
function extractProfileAttribute (data, path: string): string {
|
||||
// can handle stuff like `attrs[0].name`
|
||||
|
@ -13,7 +13,7 @@ function extractProfileAttribute (data, path: string): string {
|
|||
return data
|
||||
}
|
||||
|
||||
function parseProfile (data): Partial<Profile> {
|
||||
function parseProfile (data): Partial<PassportProfile> {
|
||||
const username = extractProfileAttribute(data, config.oauth2.userProfileUsernameAttr)
|
||||
const displayName = extractProfileAttribute(data, config.oauth2.userProfileDisplayNameAttr)
|
||||
const email = extractProfileAttribute(data, config.oauth2.userProfileEmailAttr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue