mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
trim user email in mobile sign-in router
This commit is contained in:
parent
fb4c8cb1ed
commit
673c43aee0
2 changed files with 13 additions and 18 deletions
|
|
@ -1,18 +1,17 @@
|
|||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import UserModel from '../../../datalayer/user'
|
||||
import { StatusType } from '../../../datalayer/user/model'
|
||||
import { getUserByEmail } from '../../../services/create_user'
|
||||
import { sendConfirmationEmail } from '../../../services/send_emails'
|
||||
import { comparePassword } from '../../../utils/auth'
|
||||
import { decodeAppleToken } from '../apple_auth'
|
||||
import { decodeGoogleToken } from '../google_auth'
|
||||
import {
|
||||
AuthProvider,
|
||||
DecodeTokenResult,
|
||||
JsonResponsePayload,
|
||||
AuthProvider,
|
||||
} from '../auth_types'
|
||||
import { decodeGoogleToken } from '../google_auth'
|
||||
import { createMobileAuthPayload } from '../jwt_helpers'
|
||||
import UserModel from '../../../datalayer/user'
|
||||
import { initModels } from '../../../server'
|
||||
import { sendConfirmationEmail } from '../../../services/send_emails'
|
||||
import { kx } from '../../../datalayer/knex_config'
|
||||
import { StatusType } from '../../../datalayer/user/model'
|
||||
import { comparePassword } from '../../../utils/auth'
|
||||
|
||||
export async function createMobileSignInResponse(
|
||||
isAndroid: boolean,
|
||||
|
|
@ -46,11 +45,7 @@ export async function createMobileEmailSignInResponse(
|
|||
throw new Error('Missing username or password')
|
||||
}
|
||||
|
||||
const models = initModels(kx, false)
|
||||
const user = await models.user.getWhere({
|
||||
email,
|
||||
})
|
||||
|
||||
const user = await getUserByEmail(email.trim())
|
||||
if (!user?.id || !user?.password) {
|
||||
throw new Error('user not found')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import UserModel from '../../../datalayer/user'
|
||||
import { createUser } from '../../../services/create_user'
|
||||
import { hashPassword } from '../../../utils/auth'
|
||||
import { decodeAppleToken } from '../apple_auth'
|
||||
import { decodeGoogleToken } from '../google_auth'
|
||||
import {
|
||||
AuthProvider,
|
||||
DecodeTokenResult,
|
||||
JsonResponsePayload,
|
||||
AuthProvider,
|
||||
PendingUserTokenPayload,
|
||||
} from '../auth_types'
|
||||
import { decodeGoogleToken } from '../google_auth'
|
||||
import { createPendingUserToken, suggestedUsername } from '../jwt_helpers'
|
||||
import UserModel from '../../../datalayer/user'
|
||||
import { hashPassword } from '../../../utils/auth'
|
||||
import { createUser } from '../../../services/create_user'
|
||||
|
||||
export async function createMobileSignUpResponse(
|
||||
isAndroid: boolean,
|
||||
|
|
|
|||
Loading…
Reference in a new issue