The problem is you are creating a new User record, which maps to an INSERT
statment every request/log in.
Instead you should query first to find the record. Something like this:
user = session.query(models.User).filter(
models.User.username == username).first()
if not
Hi Devs,
We have our own users database, I am doign liek this to authenticate:
try:
cred = authenticate(session, username, password)
if cred:
user = models.User(
username=username,
is_superuser=False)
user.is_active=True
session.merge(user)