コード例 #1
0
ファイル: views.py プロジェクト: VegaAISolutions/VAISWeb
from flask_login import login_user, logout_user
from itsdangerous import URLSafeTimedSerializer
from flask_login import LoginManager
import requests, sys
from html.parser import HTMLParser
from app import app
from etherscan.accounts import Account
from etherscan.stats import Stats
import blockchain

### Give darrel a hand ###
app.config[
    'SECRET_KEY'] = 'Everything in the world is either a potato, or not a potato.'
eth_addy = "0x7ee3032a81c998c9f38de324e848f187722e3edf"
### Password Salt Key ###
ts = URLSafeTimedSerializer(app.config["SECRET_KEY"])

#### MailGun Key ####
mailgun_key = 'key-5c140fd81223a56d283edc025a523a0e'

#### Etherscan Key ####
etherscan_key = 'UG4SAB8DV97VX7V15Y43GIUCKZCCP4BCU2'


def price():
    api = Stats(api_key=etherscan_key)
    last_price = api.get_ether_last_price()
    return float(last_price['ethusd'])


def btcusd():
コード例 #2
0
def generate_confirmation_token(email):
    serializer = URLSafeTimedSerializer(current_app.config['SECRET_KEY'])
    return serializer.dumps(email,
                            salt=current_app.config['SECURITY_PASSWORD_SALT'])
コード例 #3
0
from werkzeug.security import generate_password_hash, check_password_hash

from itsdangerous import URLSafeTimedSerializer, SignatureExpired

from app import app, login_manager, mail, babel
import app.utils as utils
from app.home import home
import app.constants as constants
from app.home.user_loging_manager import User

from .forms import SignupForm, SigninForm

CONFIRM_LINK_TTL = 3600
SALT_LINK = 'email-confirm'

confirm_link_generator = URLSafeTimedSerializer(app.config['SECRET_KEY'])


def flash_success(text: str):
    flash(text, 'success')


def flash_error(text: str):
    flash(text, 'danger')


# routes


@login_manager.user_loader
def load_user(user_id):