コード例 #1
0
ファイル: openid_auth.py プロジェクト: gmackie/umichdu
 def storeAssociation(self, server_url, association):
     assoc = OpenIDAssociation(
         server_url=server_url,
         handle=association.handle,
         secret=association.secret.encode('base64'),
         issued=association.issued,
         lifetime=association.lifetime,
         assoc_type=association.assoc_type
     )
     db_session.add(assoc)
     db_session.commit()
コード例 #2
0
ファイル: openid_auth.py プロジェクト: gmackie/umichdu
 def useNonce(self, server_url, timestamp, salt):
     if abs(timestamp - time()) > nonce.SKEW:
         return False
     rv = OpenIDUserNonce.query.filter(
         (OpenIDUserNonce.server_url == server_url) &
         (OpenIDUserNonce.timestamp == timestamp) &
         (OpenIDUserNonce.salt == salt)
     ).first()
     if rv is not None:
         return False
     rv = OpenIDUserNonce(server_url=server_url, timestamp=timestamp,
                          salt=salt)
     db_session.add(rv)
     db_session.commit()
     return True
コード例 #3
0
ファイル: general.py プロジェクト: gmackie/umichdu
def first_login():
    if g.user is not None or 'openid' not in session:
        return redirect(url_for('.login'))
    if request.method == 'POST':
        if 'cancel' in request.form:
            del session['openid']
            flash(u'Login was aborted')
            return redirect(url_for('general.login'))
        db_session.add(User(request.form['name'], session['openid']))
        db_session.commit()
        flash(u'Successfully created profile and logged in')
        return redirect(oid.get_next_url())
    return render_template('general/first_login.html',
                           next=oid.get_next_url(),
                           openid=session['openid'])