You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/hydro/script/register.js

17 lines
432 B
JavaScript

const user = require('../model/user');
const system = require('../model/system');
async function run({
uname, password, mail, uid,
}) {
if (!uid) uid = await system.inc('user');
else uid = parseInt(uid);
if (Number.isNaN(uid)) throw new Error('uid');
await user.create({
uid, uname, password, mail, regip: '127.0.0.1',
});
return uid;
}
global.Hydro.script.register = module.exports = { run };