Пример #1
0
def get_authorized_profile(auth_token: str,
                           params: Dict[str, Any]) -> Dict[str, Any]:
    log, args = _verify_auth_request(auth_token=auth_token, params=params)
    app = Apps.query.filter_by(_id=log.app_id).one_or_none()

    if log.is_login:
        log.status = AuthLogs.STATUS_SUCCEEDED
    elif app.option_enabled(key='reg_page'):
        log.status = AuthLogs.STATUS_WAIT_REGISTER
    else:
        SocialProfiles.activate(profile_id=log.social_id)
        log.status = AuthLogs.STATUS_SUCCEEDED

    profile = SocialProfiles.query.filter_by(_id=log.social_id).first_or_404()
    # TODO: What is fetch_user=True
    body = profile.as_dict(fetch_user=True)
    db.session.commit()

    return body
Пример #2
0
def activate_profile(auth_token: str, params: Dict[str, Any]):
    log, args = _verify_auth_request(auth_token=auth_token, params=params)
    log.status = AuthLogs.STATUS_SUCCEEDED

    SocialProfiles.activate(profile_id=log.social_id)
    db.session.commit()