lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 294 forks source link

Is UserInvitationClass/USER_ENABLE_INVITE_USER still supported ? #298

Closed gilwi closed 4 years ago

gilwi commented 4 years ago

Hi,

I'm opening this issue because I'm using this extension in one of my projects. Trying to use USER_ENABLE_INVITE_USER, it threw an error as I didn't set UserInvitationClass. But to make things work I had to uncomment line 80 of file https://github.com/lingthio/Flask-User/blob/master/flask_user/user_manager.py.

So, are you planning on dropping this feature or am I missing something?

Thanks in advance, And thank you for your great work anyways!

gilwi commented 4 years ago

In source soude I do not comment, I said I needed to uncomment line 80:

self.UserInvitationClass = UserInvitationClass # removed preceding '#'

Thanks for your help, much appreciated. We might have different setup as I did not specify mine... The initial error which led me to this "uncommenting" behaviour is:


  File "/home/myuser/myapp/app/__init__.py", line 39, in create_app
    user_manager = UserManager(app, db, User, UserInvitationClass=UserInvitation)
  File "/home/myuser/.local/lib/python3.6/site-packages/flask_user/user_manager.py", line 56, in __init__
    self.init_app(app, db, UserClass, **kwargs)
  File "/home/myuser/.local/lib/python3.6/site-packages/flask_user/user_manager.py", line 203, in init_app
    self._check_settings(app)
  File "/home/myuser/.local/lib/python3.6/site-packages/flask_user/user_manager.py", line 289, in _check_settings
    if self.USER_ENABLE_INVITE_USER and not self.UserInvitationClass:
AttributeError: 'UserManager' object has no attribute 'UserInvitationClass'
gilwi commented 4 years ago

Ok weird error, I removed package and installed again, and now I'm having a different one. Thanks for letting me know this feature is maintained!

divad1196 commented 4 years ago

Sorry, i misread your message.

here are the package in my virtual env: Flask-User-AWS (1.0.1.7) Flask-User-Social (0.0.1) Flask-User (1.0.2.2) Flask-User-06 (0.6) Flask-User-05 (0.5) Flask-User-pt (0.6.21) Flask-User-Test (9.0.2.1)

I don't know why i have all of this but i only did a pip3 install flask-user, it was about 1-2 weeks ago.

By the way, if you go to the source go here, https://github.com/lingthio/Flask-User/blob/master/flask_user/db_manager.py, it is not the same as the file you have looked at https://github.com/lingthio/Flask-User/blob/master/flask_user/user_manager.py

in fact, if you look at user_manager.py, you can see self.db_manager = DBManager(app, db, UserClass, UserEmailClass, UserInvitationClass, RoleClass)

So yes, it seems that it is maintained.

gilwi commented 4 years ago

Good to know! Thanks for your time, I was able to get it to work.