doc: attemptingLogin
Massimo Melina committed
Feb 21, 2025 at 18:32 UTC
c3c468100626fa7913e28db4f3f9c9dea5c14655
3 files changed
+11
-7
dev-plugins.md
+9
-5
@@ -547,14 +547,19 @@ The example above will return false only when the file is NOT ending with .jpg,
547
548
This section is still partially documented, and you may need to have a look at the sources for further details.
549
550
-- `deleting`
550
+- `deleting` called just before trying to delete a file or folder (which still may not exist and fail)
551
- parameters: { node, ctx }
552
- - called just before trying to delete a file or folder (which still may not exist and fail)
552
- async supported
553
- preventable
554
- `login`
555
- `logout`
557
-- `attemptingLogin`
556
+- `attemptingLogin` called when the login process starts
557
+ - parameters: { ctx, username, via? }
558
+ - via?: string
559
+ - `'url'` if login is attempted via `?login=...`, or `'header'` if it's "Basic" authentication
560
+ (which includes credentials using the @-syntax in the URL), otherwise it's standard SRP login.
561
+ - async supported
562
+ - preventable
563
- `failedLogin`
564
- `config ready`
565
- `config.KEY` where KEY is the key of a config that has changed
@@ -585,9 +590,8 @@ This section is still partially documented, and you may need to have a look at t
590
- `newSocket`
591
- parameters: { socket,ip }
592
- preventable
588
-- `getList`
593
+- `getList` called when get=list on legit requests to ?get=list
594
- parameters: { node, ctx }
590
- - called when get=list on legit requests to ?get=list
595
- async supported
596
- stoppable
597
shared/dialogs.ts
+1
-1
@@ -28,7 +28,7 @@ interface Dialog extends DialogOptions {
28
$id?: number
29
$opening?: NodeJS.Timeout
30
ts?: number
31
- close: (v?: any) => void
31
+ close: (v?: any) => undefined | Promise<void>
32
restoreFocus?: any
33
}
34
src/auth.ts
+1
-1
@@ -54,7 +54,7 @@ export async function setLoggedIn(ctx: Context, username: string | false) {
54
s.username = normalizeUsername(username)
55
s.ts = Date.now()
56
const k = CFG.allow_session_ip_change
57
- s[k] = k in ctx.query || Boolean(ctx.state.params?.[k]) || undefined
57
+ s[k] = k in ctx.query || Boolean(ctx.state.params?.[k]) || undefined // login APIs will get ctx.state.params, others can rely on ctx.query
58
if (!a.expire && a.days_to_live)
59
updateAccount(a, { expire: new Date(Date.now() + a.days_to_live! * DAY) })
60
await events.emitAsync('login', ctx)