mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
将题目纳入rating计算系统
This commit is contained in:
1 parent
bf29661eaa
commit
17b38cbf4e
19 files changed
+290
-271
No files matched your search
@@ -156,17 +156,6 @@ export function setEmail(uid: number, mail: string) {
|
||||
return setById(uid, { mail, mailLower: mail.trim().toLowerCase() });
|
||||
}
|
||||
|
||||
export async function changePassword(uid: number, currentPassword: string, newPassword: string) {
|
||||
const udoc = await getById('system', uid);
|
||||
if (!udoc) throw new UserNotFoundError(uid);
|
||||
udoc.checkPassword(currentPassword);
|
||||
const salt = String.random();
|
||||
return await coll.findOneAndUpdate(
|
||||
{ _id: udoc._id },
|
||||
{ $set: { salt, hash: pwhash(newPassword, salt), hashType: 'hydro' } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function inc(_id: number, field: string, n = 1) {
|
||||
const udoc = await coll.findOne({ _id });
|
||||
if (!udoc) throw new UserNotFoundError(_id);
|
||||
@@ -234,7 +223,6 @@ export function ensureIndexes() {
|
||||
|
||||
global.Hydro.model.user = {
|
||||
User,
|
||||
changePassword,
|
||||
create,
|
||||
getByEmail,
|
||||
getById,
|
||||
|
||||
Reference in new issue
Block a user