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 292 forks source link

self.UserInvitationClass not set in UserManager() and is checked during intialization #223

Closed h-vishal closed 4 years ago

h-vishal commented 6 years ago

If a UserInvitationClass is passed in while initializing UserManager, the class member UserInvitationClass is not set which raises a ConfigError. To fix this the UserInvitationClass member should be set when the argument UserInvitationClass is passed in.

Sb1190 commented 6 years ago

builtins.AttributeError AttributeError: 'UserManager' object has no attribute 'UserInvitationClass'

I'm really new to programming with python and I did not understand well. Any solution. Thank you

h-vishal commented 6 years ago

@Sb1190 you are trying to access the 'UserInvitationClass' member which you should not need to do, StackOverflow is probably a more appropriate forum for you question.

vvch commented 6 years ago

Seems like this attribute was commented out here about a year ago, but is still checked here causing exception (but only if USER_ENABLE_INVITE_USER is set)

nerdnum commented 5 years ago

Hi

Running Flask-User 1.0.1.5 on Windows10 with Python 3.7.2 and it is running perfectly.

In my hosting environment Ubuntu 19.04, Python 3.7.3 using the same version of Flask-User, I get the error below.

File "run.py", line 3, in <module> app = create_app() File "/home/lbecker/maranatha/app/__init__.py", line 89, in create_app user_manager = UserManager(app, db, User, UserInvitationClass=UserInvitation) File "/home/lbecker/maranatha/venv/lib/python3.7/site-packages/flask_user/user_manager.py", line 56, in __init__ self.init_app(app, db, UserClass, **kwargs) File "/home/lbecker/maranatha/venv/lib/python3.7/site-packages/flask_user/user_manager.py", line 203, in init_app self._check_settings(app) File "/home/lbecker/maranatha/venv/lib/python3.7/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' Seein the message of vvch, I looked for the offending line in in user_manager.py and uncommented it. After that the application works fine. Is it possible to have the same version number on modules that differ between Windows and Ubuntu?

GitMorin commented 5 years ago

I can confirm that what @nerdnum said solves the issue