-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset password feature with email star data (#93)
* feature(User): add tokens db * fix(user)add token repository * fix(user) : add email service * fix(user) : complete email service * fix(user) : check email service and we recived an email * fix(token) : fix token validation * feat(User) : fix Reset Password * fix(User) : add reset password from user service in new arthitecture * fix(Migrations) : add new migrations
- Loading branch information
1 parent
822a8c5
commit fa7198e
Showing
36 changed files
with
1,045 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
AnalysisData/AnalysisData/Exception/TokenException/TokenExpiredException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace AnalysisData.Exception.TokenException; | ||
|
||
public class TokenExpiredException : ServiceException | ||
{ | ||
public TokenExpiredException() : base(Resources.TokenExpiredException, StatusCodes.Status400BadRequest) | ||
{ | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
AnalysisData/AnalysisData/Exception/TokenException/TokenIsInvalidException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace AnalysisData.Exception.TokenException; | ||
|
||
public class TokenIsInvalidException : ServiceException | ||
{ | ||
public TokenIsInvalidException() : base(Resources.TokenIsInvalidException, StatusCodes.Status400BadRequest) | ||
{ | ||
} | ||
} |
42 changes: 39 additions & 3 deletions
42
...ations/20240905191436_initial.Designer.cs → .../20240907083616_InitialCreate.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
namespace AnalysisData.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class initial : Migration | ||
public partial class InitialCreate : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
|
@@ -120,6 +120,27 @@ protected override void Up(MigrationBuilder migrationBuilder) | |
onDelete: ReferentialAction.Cascade); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Tokens", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "integer", nullable: false) | ||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||
UserId = table.Column<Guid>(type: "uuid", nullable: false), | ||
Token = table.Column<string>(type: "text", nullable: false), | ||
Expiration = table.Column<DateTime>(type: "timestamp with time zone", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Tokens", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Tokens_Users_UserId", | ||
column: x => x.UserId, | ||
principalTable: "Users", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "EntityNodes", | ||
columns: table => new | ||
|
@@ -258,7 +279,7 @@ protected override void Up(MigrationBuilder migrationBuilder) | |
migrationBuilder.InsertData( | ||
table: "Users", | ||
columns: new[] { "Id", "Email", "FirstName", "ImageURL", "LastName", "Password", "PhoneNumber", "RoleId", "Username" }, | ||
values: new object[] { new Guid("31a2df40-d66d-4a7e-967c-6c3b7561da0f"), "[email protected]", "admin", null, "admin", "jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=", "09131111111", 1, "admin" }); | ||
values: new object[] { new Guid("12cb995a-4885-4ec3-9a3b-126b0ff89602"), "[email protected]", "admin", null, "admin", "jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=", "09131111111", 1, "admin" }); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_EntityEdges_EntityIDSource", | ||
|
@@ -285,6 +306,11 @@ protected override void Up(MigrationBuilder migrationBuilder) | |
table: "FileUploadedDb", | ||
column: "UploaderId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Tokens_UserId", | ||
table: "Tokens", | ||
column: "UserId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_UserFiles_FileId", | ||
table: "UserFiles", | ||
|
@@ -324,6 +350,9 @@ protected override void Up(MigrationBuilder migrationBuilder) | |
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Tokens"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "UserFiles"); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) | |
b.ToTable("ValueNodes"); | ||
}); | ||
|
||
modelBuilder.Entity("AnalysisData.User.Model.PasswordResetToken", b => | ||
{ | ||
b.Property<int>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("integer"); | ||
|
||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | ||
|
||
b.Property<DateTime>("Expiration") | ||
.HasColumnType("timestamp with time zone"); | ||
|
||
b.Property<string>("Token") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<Guid>("UserId") | ||
.HasColumnType("uuid"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.HasIndex("UserId"); | ||
|
||
b.ToTable("Tokens"); | ||
}); | ||
|
||
modelBuilder.Entity("AnalysisData.User.Model.Role", b => | ||
{ | ||
b.Property<int>("Id") | ||
|
@@ -310,7 +335,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) | |
b.HasData( | ||
new | ||
{ | ||
Id = new Guid("31a2df40-d66d-4a7e-967c-6c3b7561da0f"), | ||
Id = new Guid("12cb995a-4885-4ec3-9a3b-126b0ff89602"), | ||
Email = "[email protected]", | ||
FirstName = "admin", | ||
LastName = "admin", | ||
|
@@ -427,6 +452,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) | |
b.Navigation("Entity"); | ||
}); | ||
|
||
modelBuilder.Entity("AnalysisData.User.Model.PasswordResetToken", b => | ||
{ | ||
b.HasOne("AnalysisData.User.Model.User", "User") | ||
.WithMany() | ||
.HasForeignKey("UserId") | ||
.OnDelete(DeleteBehavior.Cascade) | ||
.IsRequired(); | ||
|
||
b.Navigation("User"); | ||
}); | ||
|
||
modelBuilder.Entity("AnalysisData.User.Model.User", b => | ||
{ | ||
b.HasOne("AnalysisData.User.Model.Role", "Role") | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.