I m trying to use the current user in my view from flask-login. So i tried to g object
I m assigning flask.ext.login.current_user
to g object
@pot.before_request
def load_users():
g.user = current_user.username
It works if the user is correct. But when i do sign-up or login as with wrong credentials I get this error
AttributeError: 'AnonymousUserMixin' object has no attribute 'username'
Please enlight me where am i wrong...