mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add param validation so we dont get undefined values passed to GQL
This commit is contained in:
parent
291bb59248
commit
c113c94567
1 changed files with 11 additions and 1 deletions
|
|
@ -356,6 +356,11 @@ export function authRouter() {
|
|||
cors<express.Request>(corsConfig),
|
||||
async (req: express.Request, res: express.Response) => {
|
||||
const { email, password } = req.body
|
||||
if (!email || !password) {
|
||||
res.redirect(`${env.client.url}/email-login?errorCodes=AUTH_FAILED`)
|
||||
return
|
||||
}
|
||||
|
||||
const query = `
|
||||
mutation login{
|
||||
login(input: {
|
||||
|
|
@ -418,6 +423,11 @@ export function authRouter() {
|
|||
cors<express.Request>(corsConfig),
|
||||
async (req: express.Request, res: express.Response) => {
|
||||
const { email, password, name, username, bio } = req.body
|
||||
if (!email || !password || !name || !username) {
|
||||
res.redirect(`${env.client.url}/email-signup?errorCodes=BAD_DATA`)
|
||||
return
|
||||
}
|
||||
|
||||
const query = `
|
||||
mutation signup {
|
||||
signup(input: {
|
||||
|
|
@ -425,7 +435,7 @@ export function authRouter() {
|
|||
password: "${password}",
|
||||
name: "${name}",
|
||||
username: "${username}",
|
||||
bio: "${bio}"
|
||||
bio: "${bio ?? ''}"
|
||||
}) {
|
||||
__typename
|
||||
... on SignupSuccess {
|
||||
|
|
|
|||
Loading…
Reference in a new issue