diff options
Diffstat (limited to 'server/tools/peertube-auth.ts')
-rw-r--r-- | server/tools/peertube-auth.ts | 12 |
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 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | import * as prompt from 'prompt' | 2 | import * as prompt from 'prompt' |
3 | import { getSettings, writeSettings, getNetrc } from './cli' | 3 | import { getNetrc, getSettings, writeSettings } from './cli' |
4 | import { isHostValid } from '../helpers/custom-validators/servers' | ||
5 | import { isUserUsernameValid } from '../helpers/custom-validators/users' | 4 | import { isUserUsernameValid } from '../helpers/custom-validators/users' |
5 | import { getAccessToken, login } from '../../shared/extra-utils' | ||
6 | 6 | ||
7 | const Table = require('cli-table') | 7 | const 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) |