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

Added send email check when changing usernames #267

Closed sabaigbe closed 4 years ago

sabaigbe commented 5 years ago

Fix for error produced when changing usernames with the USER_ENABLE_EMAIL flag set to False

[2019-07-11 10:34:59,531] ERROR in app: Exception on /user/change-username [POST]
Traceback (most recent call last):
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask_user/user_manager.py", line 390, in change_username_stub
    return self.change_username_view()
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask_user/decorators.py", line 58, in decorator
    return view_function(*args, **kwargs)
  File "/home/ubuntu/github/my_app/venv/lib/python3.5/site-packages/flask_user/user_manager__views.py", line 141, in change_username_view
    self.email_manager.send_username_changed_email(current_user)
AttributeError: 'UserManager' object has no attribute 'email_manager'
codecov-io commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@14d30bb). Click here to learn what that means. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #267   +/-   ##
=========================================
  Coverage          ?   88.55%           
=========================================
  Files             ?       25           
  Lines             ?     1451           
  Branches          ?        0           
=========================================
  Hits              ?     1285           
  Misses            ?      166           
  Partials          ?        0
Impacted Files Coverage Δ
flask_user/user_manager__views.py 95.73% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 14d30bb...4d01986. Read the comment docs.