summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-05-04 15:05:34 +0900
committerGitHub <noreply@github.com>2021-05-04 15:05:34 +0900
commit6ae642245e0322f194ca5d960f669f33ba38c2fa (patch)
treef71ac2c1a2d0aa616d4e99d37c00787219c5e3d0 /src/models
parentFix style (diff)
downloadsharkey-6ae642245e0322f194ca5d960f669f33ba38c2fa.tar.gz
sharkey-6ae642245e0322f194ca5d960f669f33ba38c2fa.tar.bz2
sharkey-6ae642245e0322f194ca5d960f669f33ba38c2fa.zip
Password reset (#7494)
* wip * wip * Update well-known.ts * wip * clean up * Update request-reset-password.ts * Update forgot-password.vue * Update reset-password.ts * Update request-reset-password.ts
Diffstat (limited to 'src/models')
-rw-r--r--src/models/entities/password-reset-request.ts30
-rw-r--r--src/models/index.ts2
2 files changed, 32 insertions, 0 deletions
diff --git a/src/models/entities/password-reset-request.ts b/src/models/entities/password-reset-request.ts
new file mode 100644
index 0000000000..6d41d38a93
--- /dev/null
+++ b/src/models/entities/password-reset-request.ts
@@ -0,0 +1,30 @@
+import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
+import { id } from '../id';
+import { User } from './user';
+
+@Entity()
+export class PasswordResetRequest {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Column('timestamp with time zone')
+ public createdAt: Date;
+
+ @Index({ unique: true })
+ @Column('varchar', {
+ length: 256,
+ })
+ public token: string;
+
+ @Index()
+ @Column({
+ ...id(),
+ })
+ public userId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public user: User | null;
+}
diff --git a/src/models/index.ts b/src/models/index.ts
index 9d08e49858..6ce453ef33 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -60,6 +60,7 @@ import { MutedNote } from './entities/muted-note';
import { ChannelFollowing } from './entities/channel-following';
import { ChannelNotePining } from './entities/channel-note-pining';
import { RegistryItem } from './entities/registry-item';
+import { PasswordResetRequest } from './entities/password-reset-request';
export const Announcements = getRepository(Announcement);
export const AnnouncementReads = getRepository(AnnouncementRead);
@@ -122,3 +123,4 @@ export const Channels = getCustomRepository(ChannelRepository);
export const ChannelFollowings = getRepository(ChannelFollowing);
export const ChannelNotePinings = getRepository(ChannelNotePining);
export const RegistryItems = getRepository(RegistryItem);
+export const PasswordResetRequests = getRepository(PasswordResetRequest);