-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/user management #24
Draft
silvareal
wants to merge
12
commits into
staging
Choose a base branch
from
feature/user-management
base: staging
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.
Draft
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9bd5a05
update folder structure/ user model added
silvareal 6b5f8c4
uodate requirements
silvareal d12ebcd
User manager auth
silvareal c32fd33
Feat: auth user router
silvareal 93a7b4b
FEAT: add user/autho2 to sqlalchemy
silvareal 2e27c66
FEAT: add autho2 to user model / migration
silvareal 68ee774
FIX: remove user schema
silvareal 5edc3ca
manage env using fastapi settings
silvareal b390a3c
move google_oauth_client client to depencies for reusability
silvareal 66753f7
update env
silvareal 1ea4c6d
update ip_address with user_id
silvareal 4b822b3
replace ip with user_id
silvareal 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
Binary file not shown.
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,5 @@ | ||
{ | ||
"python.linting.banditEnabled": false, | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Enabled": true | ||
} |
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from fastapi import Depends, Request | ||
from fastapi_users import BaseUserManager | ||
from typing import Optional | ||
from fastapi_users.authentication import JWTAuthentication | ||
|
||
from app.models.models import UserCreate, UserDB | ||
# from .db import get_user_db | ||
from app.settings import SECRET | ||
|
||
|
||
class UserManager(BaseUserManager[UserCreate, UserDB]): | ||
user_db_model = UserDB | ||
reset_password_token_secret = SECRET | ||
verification_token_secret = SECRET | ||
|
||
async def on_after_register(self, user: UserDB, request: Optional[Request] = None): | ||
print(f"User {user.id} has registered.") | ||
|
||
async def on_after_forgot_password( | ||
self, user: UserDB, token: str, request: Optional[Request] = None | ||
): | ||
print(f"User {user.id} has forgot their password. Reset token: {token}") | ||
|
||
async def on_after_request_verify( | ||
self, user: UserDB, token: str, request: Optional[Request] = None | ||
): | ||
print( | ||
f"Verification requested for user {user.id}. Verification token: {token}") | ||
|
||
|
||
async def get_user_manager(user_db): | ||
yield UserManager(user_db) | ||
|
||
jwt_authentication = JWTAuthentication( | ||
secret=SECRET, lifetime_seconds=3600, tokenUrl="auth/login") |
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
Empty file.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this file to .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add the .DS_Store and clean them up