mirror of
https://github.com/directus/directus.git
synced 2026-01-26 06:28:00 -05:00
@@ -12,6 +12,7 @@ import { userName } from '../utils/user-name';
|
||||
import { uniq } from 'lodash';
|
||||
import env from '../env';
|
||||
import validateUUID from 'uuid-validate';
|
||||
import { Url } from '../utils/url';
|
||||
|
||||
export class ActivityService extends ItemsService {
|
||||
notificationsService: NotificationsService;
|
||||
@@ -83,7 +84,9 @@ ${userName(sender)} has mentioned you in a comment:
|
||||
|
||||
${comment}
|
||||
|
||||
<a href="${env.PUBLIC_URL}/admin/content/${data.collection}/${data.item}">Click here to view.</a>
|
||||
<a href="${new Url(env.PUBLIC_URL)
|
||||
.addPath('admin', 'content', data.collection, data.item)
|
||||
.toString()}">Click here to view.</a>
|
||||
`;
|
||||
|
||||
await this.notificationsService.createOne({
|
||||
|
||||
@@ -19,6 +19,7 @@ import { UsersService } from './users';
|
||||
import { MailService } from './mail';
|
||||
import { userName } from '../utils/user-name';
|
||||
import { md } from '../utils/md';
|
||||
import { Url } from '../utils/url';
|
||||
|
||||
export class SharesService extends ItemsService {
|
||||
authorizationService: AuthorizationService;
|
||||
@@ -137,7 +138,7 @@ Hello!
|
||||
|
||||
${userName(userInfo)} has invited you to view an item in ${share.collection}.
|
||||
|
||||
[Open](${env.PUBLIC_URL}/admin/shared/${payload.share})
|
||||
[Open](${new Url(env.PUBLIC_URL).addPath('admin', 'shared', payload.share).toString()})
|
||||
`;
|
||||
|
||||
for (const email of payload.emails) {
|
||||
|
||||
@@ -324,7 +324,9 @@ export class UsersService extends ItemsService {
|
||||
|
||||
const payload = { email, scope: 'password-reset', hash: getSimpleHash('' + user.password) };
|
||||
const token = jwt.sign(payload, env.SECRET as string, { expiresIn: '1d', issuer: 'directus' });
|
||||
const acceptURL = url ? `${url}?token=${token}` : `${env.PUBLIC_URL}/admin/reset-password?token=${token}`;
|
||||
const acceptURL = url
|
||||
? new Url(url).setQuery('token', token).toString()
|
||||
: new Url(env.PUBLIC_URL).addPath('admin', 'reset-password').setQuery('token', token);
|
||||
const subjectLine = subject ? subject : 'Password Reset Request';
|
||||
|
||||
await mailService.send({
|
||||
|
||||
@@ -38,7 +38,7 @@ export class Url {
|
||||
return this.protocol === null && this.host === null;
|
||||
}
|
||||
|
||||
public addPath(...paths: string[]): Url {
|
||||
public addPath(...paths: (string | number)[]): Url {
|
||||
const pathToAdd = paths.flatMap((p) => p.split('/')).filter((p) => p !== '');
|
||||
|
||||
for (const pathSegment of pathToAdd) {
|
||||
|
||||
Reference in New Issue
Block a user