Ejemplo n.º 1
0
def apply_apply():
    # TODO
    key_id, v_code = request.form.get('key_id'), request.form.get('v_code')
    if not key_id or not v_code:
        flash('No API key information received', 'error')
        return redirect(url_for('apply_check'))
    auth = api.auth(keyID=key_id, vCode=v_code)
    characters_raw, characters = auth.account.Characters(), []
    for c in characters_raw.characters:
        characters.append({
            'name': c.characterName,
            'id': c.characterID,
            'corp': c.corporationName,
            'alliance': c.allianceName,
        })
    return render_template('apply_apply.html')
Ejemplo n.º 2
0
def apply_check():
    if not request.args.get('key_id') or not request.args.get('v_code'):
        flash('You must enter both a key id and verification code', 'error')
        return redirect(url_for('apply_home'))
    key_id, v_code = request.args.get('key_id'), request.args.get('v_code')
    auth = api.auth(keyID=key_id, vCode=v_code)
    try:
        key_info = auth.account.APIKeyInfo()
        if not key_info.key.type == 'Account':
            flash('Your key is not "Account". Please fix.', 'error')
            return redirect(url_for('apply_home'))
        if key_info.key.expires:
            flash('Your key expires. Please fix.', 'error')
            return redirect(url_for('apply_home'))
        if not key_info.key.accessMask == 268435455:
            flash('Incorrect access mask (needs to be full). Please fix.', 'error')
            return redirect(url_for('apply_home'))
        return redirect(url_for('apply_apply'), key_id=key_id, v_code=v_code)
    except Exception:
        flash('An error occurred when processing your key. Are you sure you have the correct mask set?', 'error')
        return redirect(url_for('apply_home'), **request.args)
    return render_template('apply_check.html')