]>
Commit | Line | Data |
---|---|---|
7fed6375 C |
1 | async function register ({ |
2 | registerIdAndPassAuth, | |
a4995eb7 C |
3 | peertubeHelpers, |
4 | settingsManager, | |
5 | unregisterIdAndPassAuth | |
7fed6375 C |
6 | }) { |
7 | registerIdAndPassAuth({ | |
e1c55031 | 8 | authName: 'spyro-auth', |
7fed6375 C |
9 | |
10 | onLogout: () => { | |
11 | peertubeHelpers.logger.info('On logout for auth 1 - 1') | |
12 | }, | |
13 | ||
14 | getWeight: () => 15, | |
15 | ||
16 | login (body) { | |
17 | if (body.id === 'spyro' && body.password === 'spyro password') { | |
18 | return Promise.resolve({ | |
19 | username: 'spyro', | |
20 | email: 'spyro@example.com', | |
e1c55031 | 21 | role: 2, |
7fed6375 C |
22 | displayName: 'Spyro the Dragon' |
23 | }) | |
24 | } | |
25 | ||
26 | return null | |
27 | } | |
28 | }) | |
29 | ||
30 | registerIdAndPassAuth({ | |
e1c55031 | 31 | authName: 'crash-auth', |
7fed6375 C |
32 | |
33 | onLogout: () => { | |
34 | peertubeHelpers.logger.info('On logout for auth 1 - 2') | |
35 | }, | |
36 | ||
37 | getWeight: () => 50, | |
38 | ||
39 | login (body) { | |
40 | if (body.id === 'crash' && body.password === 'crash password') { | |
41 | return Promise.resolve({ | |
42 | username: 'crash', | |
43 | email: 'crash@example.com', | |
e1c55031 | 44 | role: 1, |
7fed6375 C |
45 | displayName: 'Crash Bandicoot' |
46 | }) | |
47 | } | |
48 | ||
49 | return null | |
50 | } | |
51 | }) | |
a4995eb7 C |
52 | |
53 | settingsManager.onSettingsChange(settings => { | |
54 | if (settings.disableSpyro) { | |
55 | unregisterIdAndPassAuth('spyro-auth') | |
56 | } | |
57 | }) | |
7fed6375 C |
58 | } |
59 | ||
60 | async function unregister () { | |
61 | return | |
62 | } | |
63 | ||
64 | module.exports = { | |
65 | register, | |
66 | unregister | |
67 | } | |
68 | ||
69 | // ########################################################################### |