mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Update users.ts
Use custom acceptUrl if present. Fallback to directus default url.
This commit is contained in:
committed by
GitHub
parent
0a1d59dd45
commit
ececd1e633
@@ -125,13 +125,15 @@ export class UsersService extends ItemsService {
|
||||
}
|
||||
}
|
||||
|
||||
async requestPasswordReset(email: string) {
|
||||
async requestPasswordReset(email: string, url: string) {
|
||||
const user = await this.knex.select('id').from('directus_users').where({ email }).first();
|
||||
if (!user) throw new ForbiddenException();
|
||||
|
||||
const payload = { email, scope: 'password-reset' };
|
||||
const token = jwt.sign(payload, env.SECRET as string, { expiresIn: '1d' });
|
||||
const acceptURL = env.PUBLIC_URL + '/admin/reset-password?token=' + token;
|
||||
|
||||
let acceptURL = env.PUBLIC_URL + '/admin/reset-password?token=' + token
|
||||
if(url && url !== '') acceptURL = url + '?token=' + token
|
||||
|
||||
await sendPasswordResetMail(email, acceptURL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user