Skip to content
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

Extend User model #30

Open
jhonsfran1165 opened this issue Sep 15, 2021 · 3 comments
Open

Extend User model #30

jhonsfran1165 opened this issue Sep 15, 2021 · 3 comments

Comments

@jhonsfran1165
Copy link

Hi there! Thanks for the awesome work here!

I would like to know what is the best approach to extend the user's model. Should I send a PR for those changes or is there any other way to extend that model from my app?.

@codemation
Copy link
Owner

Hi There @jhonsfran1165 - glad you are enjoying it so far.

Perhaps you can outline in more detail how you might like to extend the current model. If the changes make since, I would be very happy to have a PR to extend it further.

@jhonsfran1165
Copy link
Author

jhonsfran1165 commented Sep 16, 2021

Sure, I think we can add some fields:

is_active: bool = True and is_verified: bool = False

I'm using those fields to validate if the user is active and if the user was validated. I wonder if those are covered somehow in easyauth. I checked the code and I find this user model:

class User(BaseModel):  
    username: str = None  
    password: Optional[str] = None
    full_name: Optional[str] = None
    email: str = None
    groups: Union[list, dict] = None

@codemation
Copy link
Owner

There is a current flow for activated users, if user activation is required i.e via sending a verification code via email.

Having a field that allows an admin to toggle on/off is a nice idea via is_active, I would only question the intent of is_verified.

Here are some other ideas / points is_active when implementing:

  • - Update model with is_active field
  • - Update Users API's to ensure field can be set / unset
  • - When a user is marked with is_active = False, we should expire / revoke tokens using this to avoid waiting for for existing tokens to expire.
  • - Optional: Translate is_active field in front_end.py to display if user is active, this code is a bit dense, so I can help here if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants