aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-auth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/peertube-auth.ts')
-rw-r--r--server/tools/peertube-auth.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts
index 1035d664a..d4ad56e47 100644
--- a/server/tools/peertube-auth.ts
+++ b/server/tools/peertube-auth.ts
@@ -1,8 +1,8 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import * as prompt from 'prompt' 2import * as prompt from 'prompt'
3import { getSettings, writeSettings, getNetrc } from './cli' 3import { getNetrc, getSettings, writeSettings } from './cli'
4import { isHostValid } from '../helpers/custom-validators/servers'
5import { isUserUsernameValid } from '../helpers/custom-validators/users' 4import { isUserUsernameValid } from '../helpers/custom-validators/users'
5import { getAccessToken, login } from '../../shared/extra-utils'
6 6
7const Table = require('cli-table') 7const Table = require('cli-table')
8 8
@@ -76,6 +76,14 @@ program
76 } 76 }
77 } 77 }
78 }, async (_, result) => { 78 }, async (_, result) => {
79 // Check credentials
80 try {
81 await getAccessToken(result.url, result.username, result.password)
82 } catch (err) {
83 console.error(err.message)
84 process.exit(-1)
85 }
86
79 await setInstance(result.url, result.username, result.password, program['default']) 87 await setInstance(result.url, result.username, result.password, program['default'])
80 88
81 process.exit(0) 89 process.exit(0)