mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bump ver,system.get更换为同步操作
This commit is contained in:
1 parent
99b7d33157
commit
03d199fe9d
19 files changed
+100
-111
No files matched your search
@@ -201,7 +201,7 @@ class DomainJoinApplicationsHandler extends ManageHandler {
|
||||
if (!this.response.body.joinSettings) {
|
||||
delete this.response.body.expirations[domain.JOIN_EXPIRATION_KEEP_CURRENT];
|
||||
}
|
||||
this.response.body.url_prefix = await system.get('server.url');
|
||||
this.response.body.url_prefix = system.get('server.url');
|
||||
this.response.body.path = [
|
||||
['Hydro', 'homepage'],
|
||||
['domain', null],
|
||||
|
||||
@@ -159,13 +159,13 @@ class HomeSecurityHandler extends Handler {
|
||||
if (udoc) throw new UserAlreadyExistError(email);
|
||||
const [code] = await token.add(
|
||||
token.TYPE_CHANGEMAIL,
|
||||
await system.get('changemail_token_expire_seconds'),
|
||||
system.get('changemail_token_expire_seconds'),
|
||||
{ uid: this.user._id, email },
|
||||
);
|
||||
const m = await this.renderHTML('user_changemail_mail.html', {
|
||||
path: `home/changeMail/${code}`,
|
||||
uname: this.user.uname,
|
||||
url_prefix: await system.get('server.url'),
|
||||
url_prefix: system.get('server.url'),
|
||||
});
|
||||
await mail.sendMail(email, 'Change Email', 'user_changemail_mail', m);
|
||||
this.response.template = 'user_changemail_mail_sent.html';
|
||||
|
||||
@@ -78,7 +78,7 @@ class SystemDashboardHandler extends SystemHandler {
|
||||
}
|
||||
|
||||
async postRestart() {
|
||||
const count = await system.get('server.worker');
|
||||
const count = system.get('server.worker');
|
||||
process.send({ event: 'restart', count });
|
||||
this.back();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class SystemSettingHandler extends SystemHandler {
|
||||
for (const s of this.response.body.settings) {
|
||||
// FIXME no-await-in-loop
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
this.response.body.current[s.key] = await system.get(s.key);
|
||||
this.response.body.current[s.key] = system.get(s.key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class FileDownloadHandler extends Handler {
|
||||
|
||||
class FileUploadHandler extends Handler {
|
||||
async getQuota() {
|
||||
let quota = await system.get('user.quota');
|
||||
let quota = system.get('user.quota');
|
||||
if (this.user.hasPriv(PRIV.PRIV_UNLIMITED_QUOTA)) {
|
||||
quota = 2 ** 63 - 1;
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ class UserRegisterHandler extends Handler {
|
||||
this.limitRate('send_mail', 3600, 30);
|
||||
const t = await token.add(
|
||||
token.TYPE_REGISTRATION,
|
||||
await system.get('session.unsaved_expire_seconds'),
|
||||
system.get('session.unsaved_expire_seconds'),
|
||||
{ mail },
|
||||
);
|
||||
if (await system.get('smtp.user')) {
|
||||
if (system.get('smtp.user')) {
|
||||
const m = await this.renderHTML('user_register_mail.html', {
|
||||
path: `register/${t[0]}`,
|
||||
url_prefix: await system.get('server.url'),
|
||||
url_prefix: system.get('server.url'),
|
||||
});
|
||||
await sendMail(mail, 'Sign Up', 'user_register_mail', m);
|
||||
this.response.template = 'user_register_mail_sent.html';
|
||||
@@ -107,18 +107,18 @@ class UserRegisterWithCodeHandler extends Handler {
|
||||
|
||||
class UserLostPassHandler extends Handler {
|
||||
async get() {
|
||||
if (!await system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
||||
if (!system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
||||
this.response.template = 'user_lostpass.html';
|
||||
}
|
||||
|
||||
@param('mail', Types.String, isEmail)
|
||||
async post(domainId: string, mail: string) {
|
||||
if (!await system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
||||
if (!system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
||||
const udoc = await user.getByEmail('system', mail);
|
||||
if (!udoc) throw new UserNotFoundError(mail);
|
||||
const [tid] = await token.add(
|
||||
token.TYPE_LOSTPASS,
|
||||
await system.get('session.unsaved_expire_seconds'),
|
||||
system.get('session.unsaved_expire_seconds'),
|
||||
{ uid: udoc._id },
|
||||
);
|
||||
const m = await this.renderHTML('user_lostpass_mail', { url: `lostpass/${tid}`, uname: udoc.uname });
|
||||
|
||||
Reference in new issue
Block a user