mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Prevent type error with the new admin script
This commit is contained in:
parent
07d21d03a5
commit
a0714b9cc8
@ -779,12 +779,14 @@ var commands = {
|
||||
|
||||
// addFirstAdmin is an anon_rpc command
|
||||
Admin.addFirstAdmin = function (Env, data, cb) {
|
||||
if (!Env.installToken) { return void cb('EINVAL'); }
|
||||
var token = data.token;
|
||||
if (!token || !data.edPublic) { return void cb('MISSING_ARGS'); }
|
||||
if (token.length !== 64 || data.edPublic.length !== 44) { return void cb('INVALID_ARGS'); }
|
||||
if (token !== Env.installToken) { return void cb('FORBIDDEN'); }
|
||||
if (Array.isArray(Env.admins) && Env.admins.length) { return void cb('EEXISTS'); }
|
||||
|
||||
var key = data.edPublic;
|
||||
if (token.length !== 64 || data.edPublic.length !== 44) { return void cb('INVALID_ARGS'); }
|
||||
|
||||
adminDecree(Env, null, function (err) {
|
||||
if (err) { return void cb(err); }
|
||||
|
||||
@ -167,6 +167,7 @@ module.exports.create = function (config) {
|
||||
|
||||
limits: {},
|
||||
admins: [],
|
||||
installToken: undefined,
|
||||
WARN: function (e, output) { // TODO deprecate this
|
||||
if (!Env.Log) { return; }
|
||||
if (e && output) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user