Add code to join users without email on login
This commit is contained in:
@ -17,8 +17,6 @@ public final class RootViewModel: ObservableObject {
|
||||
@Published public var showNewFeaturePrimer = false
|
||||
@AppStorage(UserDefaultKey.shouldShowNewFeaturePrimer.rawValue) var shouldShowNewFeaturePrimer = false
|
||||
|
||||
@Published var showMiniPlayer = false
|
||||
|
||||
public init() {
|
||||
registerFonts()
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import {
|
||||
createWebAuthToken,
|
||||
suggestedUsername,
|
||||
} from './jwt_helpers'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
|
||||
const appleBaseURL = 'https://appleid.apple.com'
|
||||
const audienceName = 'app.omnivore.app'
|
||||
@ -145,6 +146,17 @@ export async function handleAppleWebAuth(
|
||||
? ssoRedirectURL(ssoToken)
|
||||
: `${baseURL()}/home`
|
||||
|
||||
analytics.track({
|
||||
userId: user.id,
|
||||
event: 'login',
|
||||
properties: {
|
||||
method: 'apple',
|
||||
email: user.email,
|
||||
username: user.profile.username,
|
||||
env: env.server.apiEnv,
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
authToken,
|
||||
redirectURL,
|
||||
|
||||
@ -51,6 +51,7 @@ import {
|
||||
} from './google_auth'
|
||||
import { createWebAuthToken } from './jwt_helpers'
|
||||
import { createMobileAccountCreationResponse } from './mobile/account_creation'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
|
||||
export interface SignupRequest {
|
||||
email: string
|
||||
@ -323,6 +324,17 @@ export function authRouter() {
|
||||
)
|
||||
}
|
||||
|
||||
analytics.track({
|
||||
userId: user.id,
|
||||
event: 'login',
|
||||
properties: {
|
||||
method: 'google',
|
||||
email: user.email,
|
||||
username: user.profile.username,
|
||||
env: env.server.apiEnv,
|
||||
},
|
||||
})
|
||||
|
||||
res.setHeader('set-cookie', result.headers['set-cookie'])
|
||||
|
||||
await handleSuccessfulLogin(req, res, user, data.googleLogin.newUser)
|
||||
@ -447,6 +459,17 @@ export function authRouter() {
|
||||
)
|
||||
}
|
||||
|
||||
analytics.track({
|
||||
userId: user.id,
|
||||
event: 'login',
|
||||
properties: {
|
||||
method: 'email',
|
||||
email: user.email,
|
||||
username: user.profile.username,
|
||||
env: env.server.apiEnv,
|
||||
},
|
||||
})
|
||||
|
||||
await handleSuccessfulLogin(req, res, user, false)
|
||||
} catch (e) {
|
||||
logger.info('email-login exception:', e)
|
||||
@ -548,6 +571,17 @@ export function authRouter() {
|
||||
}
|
||||
}
|
||||
|
||||
analytics.track({
|
||||
userId: user.id,
|
||||
event: 'login',
|
||||
properties: {
|
||||
method: 'email_verification',
|
||||
email: user.email,
|
||||
username: user.profile.username,
|
||||
env: env.server.apiEnv,
|
||||
},
|
||||
})
|
||||
|
||||
res.set('Message', 'EMAIL_CONFIRMED')
|
||||
await handleSuccessfulLogin(req, res, user, false)
|
||||
} catch (e) {
|
||||
@ -664,6 +698,17 @@ export function authRouter() {
|
||||
)
|
||||
}
|
||||
|
||||
analytics.track({
|
||||
userId: user.id,
|
||||
event: 'login',
|
||||
properties: {
|
||||
method: 'password_reset',
|
||||
email: user.email,
|
||||
username: user.profile.username,
|
||||
env: env.server.apiEnv,
|
||||
},
|
||||
})
|
||||
|
||||
await handleSuccessfulLogin(req, res, user, false)
|
||||
} catch (e) {
|
||||
logger.info('reset-password exception:', e)
|
||||
|
||||
Reference in New Issue
Block a user