Hi,
I have this problem that it only occur when I deploy it here in pythonanywhere, it works fine on my local machine. It seems the current_user.isactive is True by default. but when run locally it's False.
index.html
{% block content %}
{% if current_user.is_active %}
<li><a href="/users">Users</a></li>
<li><a href="/logout">Log out [{{ current_user.name }}]</a></li>
{% else %}
<li><a href="/login">Log in</a></li>
<li><a href="/register">Sign up</a></li>
<li><a href="#">Gallery</a></li>
{% endif %}
...
User model
class User(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
email = db.Column(db.String(150), unique=False)
password = db.Column(db.String(150))
def __init__(self, name=None, email=None, password=None):
self.name = name
self.email = email
self.password = bcrypt.generate_password_hash(password)
def is_authenticated(self):
return True
def is_active(self):
return True
def is_anonymous(self):
return False
def get_id(self):
return unicode(self.id)
def __repr__(self):
return '<name - {}>'.format(self.name)
Any help are greatly appreciated.
Thanks.