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

type object 'User' has no attribute 'get_user_by_token' #301

Open
MajorTomaso opened this issue Mar 19, 2020 · 4 comments
Open

type object 'User' has no attribute 'get_user_by_token' #301

MajorTomaso opened this issue Mar 19, 2020 · 4 comments

Comments

@MajorTomaso
Copy link

I get this feedback after logging in:

Traceback (most recent call last):
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\asus\Desktop\group-17-electronic-voting-system\vote\routes.py", line 12, in home
    return render_template('home.html',title='Home')
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\templating.py", line 136, in render_template
    ctx.app.update_template_context(context)
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask\app.py", line 838, in update_template_context
    context.update(func())
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask_login\utils.py", line 379, in _user_context_processor
    return dict(current_user=_get_user())
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask_login\utils.py", line 346, in _get_user
    current_app.login_manager._load_user()
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask_login\login_manager.py", line 318, in _load_user
    user = self._user_callback(user_id)
  File "c:\users\asus\appdata\local\programs\python\python38-32\lib\site-packages\flask_user\user_manager.py", line 130, in load_user_by_user_token
    user = self.db_manager.UserClass.get_user_by_token(user_token)
AttributeError: type object 'User' has no attribute 'get_user_by_token'

Any help would be appreciated

@crakernano
Copy link

+1

same issue

@MRodriguez08
Copy link

+1

@MRodriguez08
Copy link

@crakernano @MajorTomaso
Seems that the version of Flask-User expects a method 'get_user_by_token' with the same algorithm as load_user in the User model:
image

Hope this help!

@GotPythonized
Copy link

Just got this error. Fixed with:

from flask_user import UserMixin

Then:

image

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

4 participants