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)
        flask_login.login_user(user)
        session.commit()
        return redirect(request.args.get("next") or url_for("admin.index"))
except AuthenticationError:
    flash("Incorrect login details")
    return self.render('airflow/login.html',
                       title="Airflow - Login",
                       form=form)
but its failing if user already exists, is there any alternative to check 
existing user and keep forwarding?

IntegrityError: (sqlite3.IntegrityError) column username is not unique [SQL: 
u'INSERT INTO users (username, email, superuser) VALUES (?, ?, ?)'] 
[parameters: (u'testuser', None, 0)] (Background on this error at: 
http://sqlalche.me/e/gkpj)


Reply via email to