-
Notifications
You must be signed in to change notification settings - Fork 0
Be 03/04/07/feat(forget password) forgot, set password, and migration #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Kocannn
wants to merge
7
commits into
development
Choose a base branch
from
be-03/04/07/feat(forget-password)-forgot&set-password
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Be 03/04/07/feat(forget password) forgot, set password, and migration #13
Kocannn
wants to merge
7
commits into
development
from
be-03/04/07/feat(forget-password)-forgot&set-password
Conversation
This file contains hidden or 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
- Implement forgot password handler to generate reset token and link - Add reset password form to validate and update user password - Create HTML templates for reset password and email confirmation - Update routes to include forgot and reset password endpoints - Add usecase methods for token verification and password reset
Add reset password functionality across repository, usecase, and handler layers. This includes: - Repository method to update user password in the database. - Usecase logic to verify token, hash password, and call repository. - HTTP handler to handle reset password requests. Also updated the domain model to include token and password fields in ForgotPassword struct and added the necessary interface methods. BREAKING CHANGE: The reset password endpoint now requires a token and password in the request body.
- Updated `ForgotPassword` use case to pass reset link to the email template. - Fixed email template rendering using `html/template` package. - Adjusted reset link to point to the correct frontend URL. - Improved error handling for email sending process. This ensures users receive a functional reset password link in their email.
Added new migration commands `migrate:create`, `migrate:up`, and `migrate:down` using the goose library. Updated dependencies for cobra and pflag to their latest versions. Removed unused imports and legacy migration code. BREAKING CHANGE: The `dbMigrate` command has been replaced with new migration commands.
- Updated `ForgotPassword` to use frontend base URL for reset link. - Added email and password validation in `ResetPassword` handler. - Introduced `ConfirmPassword` field in `ForgotPassword` struct. - Removed unused `ShowResetPasswordForm` and related assets. - Added seeding commands (`seed:create`, `seed:up`, `seed:down`). - Modified token generation to accept custom expiration time. - Updated migration command to include table prefix.
- Fixed token validation logic to correctly handle used tokens. - Improved GORM queries by using pointer semantics for better performance. - Enhanced error logging with `WithError` for better debugging context. - Removed redundant `Model()` call in the initial token query. - Improved code readability with named variables and consistent formatting. These changes enhance code clarity, maintainability, and runtime efficiency.
f7b8830
to
1d7778b
Compare
7bf0c4d
to
daf75ac
Compare
- Updated `cmd.go` to remove unused `seedDown` command. - Adjusted `migrate.go` commands to align with `goose` CLI changes. - Added new database migration files for `users`, `logout`, `events`, `registration_events`, `event_pays`, `event_speakers`, `event_tags`, `images`, and `testing` tables. - Ensured proper foreign key constraints and sequence handling. These changes improve database schema management and command usability.
daf75ac
to
fae1f49
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
add migration + seeding with goose combine with cobra command
usage migrate
go run main.go migrate:create name_migration // for create new file migration
go run main.go migrate:up // for up migration
go run main.go migrate:down // for down migration
usage for seeding
go run main.go seed:create name_seed // for create new file seed
go run main.go seed:up // run seeding file
add feature to reset password