示例#1
0
def logout():
    if current_user.is_authenticated:
        docker.stop_container(current_user.wallet_container)
        capture_event(current_user.id, 'stop_container')
        current_user.clear_wallet_data()
        capture_event(current_user.id, 'logout')
        logout_user()
    return redirect(url_for('meta.index'))
示例#2
0
def logout():
    if current_user.is_authenticated:
        docker.stop_container(current_user.wallet_container)
        send_es({'type': 'stop_container', 'user': current_user.email})
        current_user.clear_wallet_data()
        send_es({'type': 'logout', 'user': current_user.email})
        logout_user()
    return redirect(url_for('meta.index'))
示例#3
0
def delete():
    form = Delete()
    if form.validate_on_submit():
        docker.stop_container(current_user.wallet_container)
        capture_event(current_user.id, 'stop_container')
        sleep(1)
        docker.delete_wallet_data(current_user.id)
        capture_event(current_user.id, 'delete_wallet')
        current_user.clear_wallet_data(reset_password=True, reset_wallet=True)
        flash('Successfully deleted wallet data')
        return redirect(url_for('wallet.setup'))
    else:
        flash('Please confirm deletion of the account')
        return redirect(url_for('wallet.dashboard'))
示例#4
0
def delete():
    form = Delete()
    if form.validate_on_submit():
        docker.stop_container(current_user.wallet_container)
        send_es({'type': 'stop_container', 'user': current_user.email})
        sleep(1)
        docker.delete_wallet_data(current_user.id)
        send_es({'type': 'delete_wallet', 'user': current_user.email})
        current_user.clear_wallet_data(reset_password=True, reset_wallet=True)
        flash('Successfully deleted wallet data')
        return redirect(url_for('meta.index'))
    else:
        flash('Please confirm deletion of the account')
        return redirect(url_for('wallet.dashboard'))
示例#5
0
def dashboard():
    send_form = Send()
    delete_form = Delete()
    _address_qr = BytesIO()
    all_transfers = list()
    wallet = Wallet(
        proto='http',
        host='127.0.0.1',
        port=current_user.wallet_port,
        username=current_user.id,
        password=current_user.wallet_password
    )
    if not docker.container_exists(current_user.wallet_container):
        current_user.clear_wallet_data()
        return redirect(url_for('wallet.loading'))

    if not wallet.connected:
        sleep(1.5)
        return redirect(url_for('wallet.loading'))

    address = wallet.get_address()
    transfers = wallet.get_transfers()
    for type in transfers:
        for tx in transfers[type]:
            all_transfers.append(tx)
    balances = wallet.get_balances()
    qr_uri = f'wownero:{address}?tx_description={current_user.email}'
    address_qr = qrcode_make(qr_uri).save(_address_qr)
    qrcode = b64encode(_address_qr.getvalue()).decode()
    seed = wallet.seed()
    spend_key = wallet.spend_key()
    view_key = wallet.view_key()
    capture_event(current_user.id, 'load_dashboard')
    return render_template(
        'wallet/dashboard.html',
        transfers=all_transfers,
        sorted_txes=get_sorted_txes(transfers),
        balances=balances,
        address=address,
        qrcode=qrcode,
        send_form=send_form,
        delete_form=delete_form,
        user=current_user,
        seed=seed,
        spend_key=spend_key,
        view_key=view_key,
    )
示例#6
0
文件: routes.py 项目: sohamb03/xolon
def dashboard():
    send_form = Send()
    delete_form = Delete()
    _address_qr = BytesIO()
    all_transfers = list()
    wallet = Wallet(proto='http',
                    host='127.0.0.1',
                    port=current_user.wallet_port,
                    username=current_user.id,
                    password=current_user.wallet_password)
    if not docker.container_exists(current_user.wallet_container):
        current_user.clear_wallet_data()
        return redirect(url_for('wallet.loading'))

    if not wallet.connected:
        sleep(1.5)
        return redirect(url_for('wallet.loading'))

    address = wallet.get_address()

    transfers = wallet.get_transfers()
    for _type in transfers:
        for tx in transfers[_type]:
            all_transfers.append(tx)

    balances = wallet.get_balances()

    qr_uri = f'xolentum:{address}?tx_description={current_user.email}'
    qrcode_make(qr_uri).save(_address_qr)
    qrcode = b64encode(_address_qr.getvalue()).decode()

    capture_event(current_user.id, 'load_dashboard')

    _show_secrets = request.args.get('show_secrets', 'default')
    _token = request.args.get('token', 'default')

    if request.args.get('show_secrets', 'no') == 'true' and _token and \
            validate_token(_token, 60) == current_user.email:
        seed = wallet.seed()
        spend_key = wallet.spend_key()
        view_key = wallet.view_key()

        return render_template(
            'wallet/dashboard.html',
            transfers=all_transfers,
            sorted_txes=_get_sorted_txs(transfers),
            balances=balances,
            address=address,
            qrcode=qrcode,
            send_form=send_form,
            delete_form=delete_form,
            user=current_user,
            seed=seed,
            spend_key=spend_key,
            view_key=view_key,
        )

    else:
        secrets_form = Secrets()

        return render_template(
            'wallet/dashboard.html',
            transfers=all_transfers,
            sorted_txes=_get_sorted_txs(transfers),
            balances=balances,
            address=address,
            qrcode=qrcode,
            send_form=send_form,
            secrets_form=secrets_form,
            delete_form=delete_form,
            user=current_user,
        )