Exemple #1
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(content)
     result.tif = int(data['tif'][0])
     result.suk = base64url.decode(data['suk'][0]) if 'suk' in data else ''
     result.vuk = base64url.decode(data['vuk'][0]) if 'vuk' in data else ''
     return result
Exemple #2
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(content)
     result.tif = int(data['tif'][0])
     result.suk = base64url.decode(data['suk'][0]) if 'suk' in data else ''
     result.vuk = base64url.decode(data['vuk'][0]) if 'vuk' in data else ''
     return result
Exemple #3
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(content)
     result.client = SqrlRequestBodyClientArgs.deserialize(data['client'][0])
     result.server = base64url.decode(data['server'][0])
     result.ids = base64url.decode(data['ids'][0])
     result.pids = base64url.decode(data['pids'][0]) if 'pids' in data else ''
     result.urs = base64url.decode(data['urs'][0]) if 'urs' in data else ''
     return result
Exemple #4
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(base64url.decode(content))
     result.ver = data['ver'][0]
     result.cmd = data['cmd'][0]
     result.idk = base64url.decode(data['idk'][0])
     result.pidk = base64url.decode(data['pidk'][0]) if 'pidk' in data else ''
     result.suk = base64url.decode(data['suk'][0]) if 'suk' in data else ''
     result.vuk = base64url.decode(data['vuk'][0]) if 'vuk' in data else ''
     return result
Exemple #5
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(base64url.decode(content))
     result.ver = data['ver'][0]
     result.cmd = data['cmd'][0]
     result.idk = base64url.decode(data['idk'][0])
     result.pidk = base64url.decode(
         data['pidk'][0]) if 'pidk' in data else ''
     result.suk = base64url.decode(data['suk'][0]) if 'suk' in data else ''
     result.vuk = base64url.decode(data['vuk'][0]) if 'vuk' in data else ''
     return result
Exemple #6
0
 def deserialize(cls, content):
     result = cls()
     data = urlparse.parse_qs(content)
     result.client = SqrlRequestBodyClientArgs.deserialize(
         data['client'][0])
     result.server = base64url.decode(data['server'][0])
     result.ids = base64url.decode(data['ids'][0])
     result.pids = base64url.decode(
         data['pids'][0]) if 'pids' in data else ''
     result.urs = base64url.decode(data['urs'][0]) if 'urs' in data else ''
     return result
Exemple #7
0
def qrcode_svg():
    info = urlparse.urlparse(request.url)
    if len(info.query) > 0:
        login_url = base64url.decode(info.query.encode('utf-8'))
        img = qrcode.make(login_url, image_factory=qrcode.image.svg.SvgImage)
        res = StringIO()
        img.save(res)
        res.seek(0)
        return send_file(res, mimetype='image/svg+xml')
    else:
        abort(400)
Exemple #8
0
def qrcode_svg():
    info = urlparse.urlparse(request.url)
    if len(info.query) > 0:
        login_url = base64url.decode(info.query.encode('utf-8'))
        img = qrcode.make(login_url, image_factory=qrcode.image.svg.SvgImage)
        res = StringIO()
        img.save(res)
        res.seek(0)
        return send_file(res, mimetype='image/svg+xml')
    else:
        abort(400)
Exemple #9
0
def qrcode_svg():
    if '?' in request.url:
        parts = request.url.split('?')
        qr_data = parts[1].strip()
        login_url = base64url.decode(qr_data)
        img = qrcode.make(login_url, image_factory=qrcode.image.svg.SvgImage)
        res = StringIO()
        img.save(res)
        res.seek(0)
        return send_file(res, mimetype='image/svg+xml')
    else:
        abort(400)