plugins: event failedLogin parameters are now consistent with event attemptingLogin
Massimo Melina committed
May 8, 2025 at 14:22 UTC
8ec2b4a7343426915d7c968959abe901a3ae4434
4 files changed
+6
-5
dev-plugins.md
+3
-2
@@ -612,7 +612,8 @@ This section is still partially documented, and you may need to have a look at t
612
- async supported
613
- preventable
614
- `failedLogin`
615
-- `clearTextLogin` give plugins the chance to authenticate users
615
+ - parameters: { ctx, username, via? }
616
+- - `clearTextLogin` give plugins the chance to authenticate users
617
- parameters: { ctx, username, password, via: 'url' | 'header' }
618
- async supported
619
- return: `true` to consider authentication done
@@ -633,7 +634,6 @@ This section is still partially documented, and you may need to have a look at t
634
- `spam`
635
- `log`
636
- `error_log`
636
-- `failedLogin`
637
- `accountRenamed`
638
- `pluginDownload`
639
- `pluginUpdated`
@@ -648,6 +648,7 @@ This section is still partially documented, and you may need to have a look at t
648
- preventable
649
- return: callback to call when upload is finished
650
- `uploadFinished`
651
+ - parameters: { ctx, uri, writeStream }
652
- `publicIpsChanged`
653
- parameters: { IPs, IP4, IP6, IPX }
654
- `newSocket`
src/api.auth.ts
+1
-1
@@ -87,7 +87,7 @@ export const loginSrp2: ApiHandler = async ({ pubKey, proof }, ctx) => {
87
catch(e) {
88
ctx.logExtra({ u: username })
89
ctx.state.dontLog = false // log even if log_api is false
90
- events.emit('failedLogin', ctx, { username })
90
+ events.emit('failedLogin', { ctx, username })
91
return new ApiError(HTTP_UNAUTHORIZED, e ? String(e) : undefined)
92
}
93
finally {
src/auth.ts
+1
-1
@@ -47,7 +47,7 @@ export async function clearTextLogin(ctx: Context, u: string, p: string, via: st
47
ctx.headers['x-username'] = a.username // give an easier way to determine if the login was successful
48
}
49
else if (u)
50
- events.emit('failedLogin', ctx, { username: u, via })
50
+ events.emit('failedLogin', { ctx, username: u, via })
51
return a
52
}
53
src/const.ts
+1
-1
@@ -9,7 +9,7 @@ import { formatTimestamp } from './cross'
9
import { argv } from './argv'
10
export * from './cross-const'
11
12
-export const API_VERSION = 12.3
12
+export const API_VERSION = 12.4
13
export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
14
15
// you can add arguments with this file, currently used for the update process on mac/linux