airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudhir Babu Pothineni <sbpothin...@gmail.com>
Subject Re: custom auth
Date Wed, 06 Mar 2019 22:01:12 GMT
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)



Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message