aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js')
-rw-r--r--server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js
index c0e560019..ceab7b60d 100644
--- a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js
+++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js
@@ -11,6 +11,24 @@ async function register ({
11 11
12 getWeight: () => 30, 12 getWeight: () => 30,
13 13
14 hookTokenValidity: (options) => {
15 if (options.type === 'refresh') {
16 return { valid: false }
17 }
18
19 if (options.type === 'access') {
20 const token = options.token
21 const now = new Date()
22 now.setTime(now.getTime() - 5000)
23
24 const createdAt = new Date(token.createdAt)
25
26 return { valid: createdAt.getTime() >= now.getTime() }
27 }
28
29 return { valid: true }
30 },
31
14 login (body) { 32 login (body) {
15 if (body.id === 'laguna' && body.password === 'laguna password') { 33 if (body.id === 'laguna' && body.password === 'laguna password') {
16 return Promise.resolve({ 34 return Promise.resolve({