コード例 #1
0
ファイル: adminauth.py プロジェクト: dbcaturra/bpm-panela
def authorized():
    resp = google.authorized_response()
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
            request.args['error_reason'],
            request.args['error_description']
        )
    session['google_token'] = (resp['access_token'], '')
    me = google.get('userinfo')
    #app.config['userdata'] = me.data
    user = User.query(User.email == me.data['email']).fetch()
    if not user:
        user = User()
        user.name = me.data['name']
        user.email = me.data['email']
        user.thumbnail = me.data['picture']
        user.active = True
        user.authenticated = True
        user.anonymous = True
        user.active = True
        user.put()
    session['user_id'] = me.data['email']
    session['_fresh'] = True
    flash('Logged in successfully.')
    return redirect(urlservice)
コード例 #2
0
ファイル: users.py プロジェクト: molinamiguel/cityhall
 def create_user(self, author, user, passhash, user_root):
     u = User()
     u.author = author
     u.user_root = user_root
     u.active = True
     u.name = user
     u.password = passhash
     u.save()