CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/database/pool/account/set-password.ts
Views: 687
1
import getPool from "@cocalc/database/pool";
2
import passwordHash from "@cocalc/backend/auth/password-hash";
3
export default async function setPassword(
4
account_id: string,
5
password: string
6
): Promise<void> {
7
const pool = getPool();
8
await pool.query("UPDATE accounts SET password_hash=$1 WHERE account_id=$2", [
9
passwordHash(password),
10
account_id,
11
]);
12
}
13
14