mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复邮件注册异常
This commit is contained in:
1 parent
46630065aa
commit
5d1a3402e0
2 files changed
+6
-6
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.15",
|
"version": "2.13.16",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class UserRegisterHandler extends Handler {
|
|||||||
this.limitRate('send_mail', 3600, 30);
|
this.limitRate('send_mail', 3600, 30);
|
||||||
const t = await token.add(
|
const t = await token.add(
|
||||||
token.TYPE_REGISTRATION,
|
token.TYPE_REGISTRATION,
|
||||||
await system.get('registration_token_expire_seconds'),
|
await system.get('session.unsaved_expire_seconds'),
|
||||||
{ mail },
|
{ mail },
|
||||||
);
|
);
|
||||||
if (await system.get('smtp.user')) {
|
if (await system.get('smtp.user')) {
|
||||||
@@ -82,9 +82,9 @@ class UserRegisterWithCodeHandler extends Handler {
|
|||||||
@param('code', Types.String)
|
@param('code', Types.String)
|
||||||
async get(domainId: string, code: string) {
|
async get(domainId: string, code: string) {
|
||||||
this.response.template = 'user_register_with_code.html';
|
this.response.template = 'user_register_with_code.html';
|
||||||
const { mail } = await token.get(code, token.TYPE_REGISTRATION);
|
const tdoc = await token.get(code, token.TYPE_REGISTRATION);
|
||||||
if (!mail) throw new InvalidTokenError(token.TYPE_REGISTRATION, code);
|
if (!tdoc) throw new InvalidTokenError(token.TYPE_REGISTRATION, code);
|
||||||
this.response.body = { mail };
|
this.response.body = tdoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('password', Types.String, isPassword)
|
@param('password', Types.String, isPassword)
|
||||||
@@ -118,7 +118,7 @@ class UserLostPassHandler extends Handler {
|
|||||||
if (!udoc) throw new UserNotFoundError(mail);
|
if (!udoc) throw new UserNotFoundError(mail);
|
||||||
const [tid] = await token.add(
|
const [tid] = await token.add(
|
||||||
token.TYPE_LOSTPASS,
|
token.TYPE_LOSTPASS,
|
||||||
await system.get('lostpass_token_expire_seconds'),
|
await system.get('session.unsaved_expire_seconds'),
|
||||||
{ uid: udoc._id },
|
{ uid: udoc._id },
|
||||||
);
|
);
|
||||||
const m = await this.renderHTML('user_lostpass_mail', { url: `lostpass/${tid}`, uname: udoc.uname });
|
const m = await this.renderHTML('user_lostpass_mail', { url: `lostpass/${tid}`, uname: udoc.uname });
|
||||||
|
|||||||
Reference in new issue
Block a user