-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw invalid credentials error explictly
- Loading branch information
Showing
9 changed files
with
23 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
waspc/data/Generator/templates/server/src/routes/auth/logout.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { handleRejection } from 'wasp/server/utils' | ||
import { throwInvalidCredentialsError } from 'wasp/auth/utils' | ||
import { createInvalidCredentialsError } from 'wasp/auth/utils' | ||
import { invalidateSession } from 'wasp/auth/session' | ||
|
||
export default handleRejection(async (req, res) => { | ||
if (req.sessionId) { | ||
await invalidateSession(req.sessionId) | ||
return res.json({ success: true }) | ||
} else { | ||
throwInvalidCredentialsError() | ||
throw createInvalidCredentialsError() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { serialize as superjsonSerialize } from 'superjson' | ||
import { handleRejection } from 'wasp/server/utils' | ||
import { throwInvalidCredentialsError } from 'wasp/auth/utils' | ||
import { createInvalidCredentialsError } from 'wasp/auth/utils' | ||
|
||
export default handleRejection(async (req, res) => { | ||
if (req.user) { | ||
return res.json(superjsonSerialize(req.user)) | ||
} else { | ||
throwInvalidCredentialsError() | ||
throw createInvalidCredentialsError() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters