Exemple #1
0
def send_passwords(request, user, preferences_link, backups_link):
    passwords = get_user_passwords(user)
    if not passwords:
        return False

    context = {
        'user': user,
        'preferences_link': preferences_link,
        'backups_link': backups_link,
    }

    today = datetime.date.today()
    attachment = Attachment(get_backup_filename(today),
                            "application/yith",
                            compress(passwords))

    send_email(
        request,
        'yithlibraryserver.backups:templates/email_passwords',
        context,
        "Your Yith Library's passwords",
        [user.email],
        attachments=[attachment],
    )

    return True
Exemple #2
0
def send_passwords(request, user, preferences_link, backups_link):
    passwords = get_user_passwords(user)
    if not passwords:
        return False

    context = {
        'user': user,
        'preferences_link': preferences_link,
        'backups_link': backups_link,
    }

    today = datetime.date.today()
    attachment = Attachment(get_backup_filename(today), "application/yith",
                            compress(passwords))

    send_email(
        request,
        'yithlibraryserver.backups:templates/email_passwords',
        context,
        "Your Yith Library's passwords",
        [user.email],
        attachments=[attachment],
    )

    return True
Exemple #3
0
def backups_export(request):
    passwords = get_user_passwords(request.db, request.user)
    data = compress(passwords)
    response = Response(body=data, content_type='application/yith-library')
    today = datetime.date.today()
    filename = get_backup_filename(today)
    response.content_disposition = 'attachment; filename=%s' % filename
    return response
Exemple #4
0
def backups_export(request):
    passwords = get_user_passwords(request.user)
    data = compress(passwords)
    response = Response(body=data, content_type='application/yith-library')
    today = datetime.date.today()
    filename = get_backup_filename(today)
    response.content_disposition = 'attachment; filename=%s' % filename
    return response
    def test_compress_and_uncompress(self):
        passwords = [{
            'account': '',
            'creation': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'expiration': None,
            'modification': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'notes': '',
            'secret': 's3cr3t2',
            'service': '',
            'tags': [],
        }, {
            'account': '',
            'creation': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'expiration': None,
            'modification': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'notes': '',
            'secret': 's3cr3t2',
            'service': '',
            'tags': [],
        }]

        self.assertEqual(uncompress(compress(passwords)), passwords)
Exemple #6
0
    def test_compress_and_uncompress(self):
        passwords = [{
            'account': '',
            'creation': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'expiration': None,
            'modification': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'notes': '',
            'secret': 's3cr3t2',
            'service': '',
            'tags': [],
        }, {
            'account': '',
            'creation': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'expiration': None,
            'modification': datetime.datetime(2014, 2, 23, 8, 0, 0),
            'notes': '',
            'secret': 's3cr3t2',
            'service': '',
            'tags': [],
        }]

        self.assertEqual(uncompress(compress(passwords)), passwords)
    def test_compress_and_uncompress(self):
        passwords = [{'password': '******'}, {'password': '******'}]

        self.assertEqual(uncompress(compress(passwords)), passwords)