-
Notifications
You must be signed in to change notification settings - Fork 1
Implementa autenticação social via Google OAuth2 no fluxo de login da plataforma. #470
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
RafaelFantinel
wants to merge
11
commits into
develop
Choose a base branch
from
feature/google-login
base: develop
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a6c9ba7
Merge pull request #458 from vcnafacul/develop
FernandoAlmeidaPinto 47462b4
feat(user): implementa login social com Google
RafaelFantinel 0f17b39
fix(security): prevent account takeover and validate google email
RafaelFantinel ec789e6
fix(validation): enforce lgpd acceptance and add length constraints
RafaelFantinel 1a5ef0c
fix(migration): make down() safe when nullable columns contain nulls
RafaelFantinel 3dba021
fix(config): correct google oauth callback url to include /user/ prefix
RafaelFantinel e4cb962
feat(swagger): document google oauth endpoints and clean up decorators
RafaelFantinel d314b94
chore(deps): add @types/passport-google-oauth20 dev dependency
RafaelFantinel 3e2761c
Merge branch 'develop' into feature/google-login
RafaelFantinel 3e65013
Merge branch 'develop' into feature/google-login
FernandoAlmeidaPinto 8b8f9ee
docs(social-login): clarify emailConfirmSended null semantics in goog…
FernandoAlmeidaPinto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
|
||
| export class GoogleSocialLogin1778250000000 implements MigrationInterface { | ||
| name = 'GoogleSocialLogin1778250000000'; | ||
|
|
||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`password\` varchar(255) NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`phone\` varchar(255) NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`gender\` int NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`birthday\` datetime NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`state\` varchar(255) NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`city\` varchar(255) NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` ADD \`google_id\` varchar(255) NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` ADD UNIQUE INDEX \`IDX_users_google_id\` (\`google_id\`)`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` ADD \`profile_complete\` tinyint NULL`, | ||
| ); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` DROP COLUMN \`profile_complete\``, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` DROP INDEX \`IDX_users_google_id\``, | ||
| ); | ||
| // Remover usuários criados via Google antes de restaurar NOT NULL, | ||
| // pois esses registros possuem colunas obrigatórias nulas. | ||
| await queryRunner.query( | ||
| `DELETE FROM \`users\` WHERE \`google_id\` IS NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` DROP COLUMN \`google_id\``, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`city\` = '' WHERE \`city\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`city\` varchar(255) NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`state\` = '' WHERE \`state\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`state\` varchar(255) NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`birthday\` = '1970-01-01' WHERE \`birthday\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`birthday\` datetime NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`gender\` = 0 WHERE \`gender\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`gender\` int NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`phone\` = '' WHERE \`phone\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`phone\` varchar(255) NOT NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `UPDATE \`users\` SET \`password\` = '' WHERE \`password\` IS NULL`, | ||
| ); | ||
| await queryRunner.query( | ||
| `ALTER TABLE \`users\` MODIFY \`password\` varchar(255) NOT NULL`, | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.