@cocalc/server
Version:
CoCalc server functionality: functions used by either the hub and the next.js server
23 lines (21 loc) • 879 B
JavaScript
;
/*
If the account with given id does not exist, throw an error.
Return true if the account with given id exists and has a password set.
Otherwise, return false... since auth is only doing via a passport.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const pool_1 = __importDefault(require("@cocalc/database/pool"));
async function hasPassword(account_id) {
const pool = (0, pool_1.default)("short");
const { rows } = await pool.query("SELECT password_hash FROM accounts WHERE account_id=$1::UUID", [account_id]);
if (rows.length == 0) {
throw Error("no such account");
}
return !!rows[0].password_hash;
}
exports.default = hasPassword;
//# sourceMappingURL=has-password.js.map