Skip to content

Commit

Permalink
fix onregister res in clientInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
prostgles committed Dec 29, 2024
1 parent 94946cd commit 4003640
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
17 changes: 12 additions & 5 deletions docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ prostgles<DBGeneratedSchema>({

Called when a socket disconnects

- **auth** <span style="color: grey">optional</span> <span style="color: green;">Auth</span>
- **auth** <span style="color: grey">optional</span> <span style="color: green;">AuthConfig</span>

Auth configuration.
Supports email and OAuth strategies
Expand All @@ -201,7 +201,7 @@ prostgles<DBGeneratedSchema>({
- PublishParams - userData and/or sid (in testing) are passed to the publish function
- auth.expressConfig.use - express middleware to get user data and
undefined sid is allowed to enable public users
- **expressConfig** <span style="color: grey">optional</span> <span style="color: green;">ExpressConfig</span>
- **loginSignupConfig** <span style="color: grey">optional</span> <span style="color: green;">LoginSignupConfig</span>

Will setup auth routes
/login
Expand Down Expand Up @@ -232,9 +232,16 @@ prostgles<DBGeneratedSchema>({

If defined, will enable GET /magic-link/:id route.
Requests with valid magic link ids will be logged in and redirected to the returnUrl if set
- **registrations** <span style="color: grey">optional</span> <span style="color: green;">AuthRegistrationConfig&lt;S&gt; | undefined</span>
- **login** <span style="color: grey">optional</span> <span style="color: green;">(params: LoginParams, dbo: DBOFullyTyped&lt;S&gt;, db: DB, client: LoginClientInfo) =&gt; Awaitable&lt;LoginResponse&gt;</span>
- **logout** <span style="color: grey">optional</span> <span style="color: green;">(sid: string | undefined, dbo: DBOFullyTyped&lt;S&gt;, db: DB) =&gt; any</span>
- **signupWithEmailAndPassword** <span style="color: grey">optional</span> <span style="color: green;">SignupWithEmailAndPassword | undefined</span>
- **loginWithOAuth** <span style="color: grey">optional</span> <span style="color: green;">LoginWithOAuthConfig&lt;S&gt; | undefined</span>
- **localLoginMode** <span style="color: grey">optional</span> <span style="color: green;">LocalLoginMode | undefined</span>

Used to hint to the client which login mode is available
Defaults to username and password
- **login** <span style="color: red">required</span> <span style="color: green;">(params: LoginParams, dbo: DBOFullyTyped&lt;S&gt;, db: DB, client: LoginClientInfo) =&gt; Awaitable&lt;LoginResponse&gt;</span>

If provided then the user will be able to login with a username and password
- **logout** <span style="color: red">required</span> <span style="color: green;">(sid: string | undefined, dbo: DBOFullyTyped&lt;S&gt;, db: DB) =&gt; Awaitable&lt;void&gt;</span>
- **responseThrottle** <span style="color: grey">optional</span> <span style="color: green;">number</span>

Response time rounding in milliseconds to prevent timing attacks on login. Login response time should always be a multiple of this value. Defaults to 500 milliseconds
Expand Down
2 changes: 1 addition & 1 deletion lib/Auth/endpoints/setRegisterRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const setRegisterRequestHandler = async (
});
}
try {
const { httpReq, ...clientInfo } = getClientRequestIPsInfo({ httpReq: req, res });
const { httpReq, ...clientInfo } = getClientRequestIPsInfo({ httpReq: req });
const result = await onRegister({
email: username,
password,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prostgles-server",
"version": "4.2.203",
"version": "4.2.204",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tests/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4003640

Please sign in to comment.