mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 19:41:26 +10:00
feat(backend): forgot password (#250)
* feat(backend): forgot password * feat: apply feedback from code review * chore(auth): validate the minimum length of 'newPassword' * chore(auth): make token has an expiry of 1 hour * chore: rename all occurrences of 'code' to 'token' * chore(backend): provide value on nanoIdGen method
This commit is contained in:
@ -62,9 +62,9 @@ export class EnvironmentService {
|
||||
getAwsS3Endpoint(): string {
|
||||
return this.configService.get<string>('AWS_S3_ENDPOINT');
|
||||
}
|
||||
|
||||
|
||||
getAwsS3ForcePathStyle(): boolean {
|
||||
return this.configService.get<boolean>('AWS_S3_FORCE_PATH_STYLE')
|
||||
return this.configService.get<boolean>('AWS_S3_FORCE_PATH_STYLE');
|
||||
}
|
||||
|
||||
getAwsS3Url(): string {
|
||||
|
||||
@ -4,6 +4,6 @@ import { ImportController } from './import.controller';
|
||||
|
||||
@Module({
|
||||
providers: [ImportService],
|
||||
controllers: [ImportController]
|
||||
controllers: [ImportController],
|
||||
})
|
||||
export class ImportModule {}
|
||||
|
||||
@ -27,11 +27,14 @@ export const mailDriverConfigProvider = {
|
||||
switch (driver) {
|
||||
case MailOption.SMTP:
|
||||
let auth = undefined;
|
||||
if (environmentService.getSmtpUsername() && environmentService.getSmtpPassword()) {
|
||||
if (
|
||||
environmentService.getSmtpUsername() &&
|
||||
environmentService.getSmtpPassword()
|
||||
) {
|
||||
auth = {
|
||||
user: environmentService.getSmtpUsername(),
|
||||
pass: environmentService.getSmtpPassword(),
|
||||
};
|
||||
user: environmentService.getSmtpUsername(),
|
||||
pass: environmentService.getSmtpPassword(),
|
||||
};
|
||||
}
|
||||
return {
|
||||
driver,
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
import { Section, Text } from '@react-email/components';
|
||||
import * as React from 'react';
|
||||
import { content, paragraph } from '../css/styles';
|
||||
import { MailBody } from '../partials/partials';
|
||||
|
||||
interface Props {
|
||||
username: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export const ForgotPasswordEmail = ({ username, code }: Props) => {
|
||||
return (
|
||||
<MailBody>
|
||||
<Section style={content}>
|
||||
<Text style={paragraph}>Hi {username},</Text>
|
||||
<Text style={paragraph}>
|
||||
The code for resetting your password is: <strong>{code}</strong>.
|
||||
</Text>
|
||||
<Text style={paragraph}>
|
||||
If you did not request a password reset, please ignore this email.
|
||||
</Text>
|
||||
</Section>
|
||||
</MailBody>
|
||||
);
|
||||
}
|
||||
|
||||
export default ForgotPasswordEmail;
|
||||
@ -1,6 +1,6 @@
|
||||
export const formatDate = (date: Date) => {
|
||||
new Intl.DateTimeFormat("en", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "medium",
|
||||
new Intl.DateTimeFormat('en', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'medium',
|
||||
}).format(date);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user