mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: update mail url builder logic
This commit is contained in:
1 parent
b3e56c078a
commit
616af2655e
3 files changed
+9
-7
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -193,10 +193,11 @@ class HomeSecurityHandler extends Handler {
|
||||
system.get('session.unsaved_expire_seconds'),
|
||||
{ uid: this.user._id, email },
|
||||
);
|
||||
const prefix = (this.domain.host || [])[0] || system.get('server.url');
|
||||
const m = await this.renderHTML('user_changemail_mail.html', {
|
||||
path: `home/changeMail/${code}`,
|
||||
path: `/home/changeMail/${code}`,
|
||||
uname: this.user.uname,
|
||||
url_prefix: (this.domain.host || [])[0] || system.get('server.url'),
|
||||
url_prefix: prefix.endsWith('/') ? prefix.slice(0, -1) : prefix,
|
||||
});
|
||||
await mail.sendMail(email, 'Change Email', 'user_changemail_mail', m);
|
||||
this.response.template = 'user_changemail_mail_sent.html';
|
||||
|
||||
@@ -170,12 +170,13 @@ export class UserRegisterHandler extends Handler {
|
||||
system.get('session.unsaved_expire_seconds'),
|
||||
{ mail, redirect: this.domain.registerRedirect },
|
||||
);
|
||||
const prefix = this.domain.host
|
||||
? `${this.domain.host instanceof Array ? this.domain.host[0] : this.domain.host}/`
|
||||
: system.get('server.url');
|
||||
if (system.get('smtp.verify') && system.get('smtp.user')) {
|
||||
const m = await this.renderHTML('user_register_mail.html', {
|
||||
path: `register/${t[0]}`,
|
||||
url_prefix: this.domain.host
|
||||
? `${this.domain.host instanceof Array ? this.domain.host[0] : this.domain.host}/`
|
||||
: system.get('server.url'),
|
||||
path: `/register/${t[0]}`,
|
||||
url_prefix: prefix.endsWith('/') ? prefix.slice(0, -1) : prefix,
|
||||
});
|
||||
await sendMail(mail, 'Sign Up', 'user_register_mail', m);
|
||||
this.response.template = 'user_register_mail_sent.html';
|
||||
|
||||
Reference in new issue
Block a user