mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Send reset password recordId as query parameter
This is a revert of a previous change but is now possible due to the use of JSON bodies. This does mean JavaScript is required in the HTML page, but that will be required for future changes anyway.
This commit is contained in:
@@ -68,7 +68,8 @@ export class ForgotPasswordHandler extends InteractionHandler {
|
||||
*/
|
||||
private async sendResetMail(recordId: string, email: string): Promise<void> {
|
||||
this.logger.info(`Sending password reset to ${email}`);
|
||||
const resetLink = joinUrl(this.baseUrl, this.idpPath, `resetpassword/${recordId}`);
|
||||
// `joinUrl` strips trailing slash when query parameter gets added
|
||||
const resetLink = `${joinUrl(this.baseUrl, this.idpPath, 'resetpassword/')}?rid=${recordId}`;
|
||||
const renderedEmail = await this.templateEngine.render({ resetLink });
|
||||
await this.emailSender.handleSafe({
|
||||
recipient: email,
|
||||
|
||||
@@ -21,10 +21,8 @@ export class ResetPasswordHandler extends InteractionHandler {
|
||||
}
|
||||
|
||||
public async handle({ operation }: InteractionHandlerInput): Promise<InteractionResponseResult> {
|
||||
// Extract record ID from request URL
|
||||
const recordId = /\/([^/]+)$/u.exec(operation.target.path)?.[1];
|
||||
// Validate input data
|
||||
const { password, confirmPassword } = await readJsonStream(operation.body.data);
|
||||
const { password, confirmPassword, recordId } = await readJsonStream(operation.body.data);
|
||||
assert(
|
||||
typeof recordId === 'string' && recordId.length > 0,
|
||||
'Invalid request. Open the link from your email again',
|
||||
|
||||
Reference in New Issue
Block a user