Use Url util to construct urls everywhere (#12394)

Fixes #12345
This commit is contained in:
Rijk van Zanten
2022-03-25 13:21:59 -04:00
committed by GitHub
parent ff4fc3b8a9
commit caf698ed2f
4 changed files with 10 additions and 4 deletions

View File

@@ -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({