Пример #1
0
def do_invite_backlog(m, filename):
    users = RedisTable(m.redis, 'h:users')
    with open(filename) as fh:
        for line in fh:
            line = line.rstrip('\n "')
            email = line.split(' "')[1]
            if m.redis.hget('h:invites', email):
                print('Already invited: ' + email)
                continue

            if m.redis.hget('h:arc_invites', email):
                print('Already Registered: ' + email)
                continue

            skip = False
            for n, v in users.iteritems():
                if v['email_addr'] == email:
                    skip = True
                    print('Already User: '******'INVITING: ' + email)
            m.redis.hset('h:invites', email, json.dumps({'email': email,
                                                         'desc': 'from letmeknow list',
                                                         'name': email}))

            do_invite(m, email, 'templates/emailinvite2.html')
Пример #2
0
def list_not_invited(m, invite=False):
    invites = RedisTable(m.redis, 'h:invites')
    for email, v in invites.iteritems():
        if 'sent' not in v:
            if invite:
                do_invite(m, email)
            print((email + ': ' + v.get('name', '') + ' -- ' + v.get('desc', '')).encode('utf-8'))
Пример #3
0
def do_invite_backlog(m, filename):
    users = RedisTable(m.redis, 'h:users')
    with open(filename) as fh:
        for line in fh:
            line = line.rstrip('\n "')
            email = line.split(' "')[1]
            if m.redis.hget('h:invites', email):
                print('Already invited: ' + email)
                continue

            if m.redis.hget('h:arc_invites', email):
                print('Already Registered: ' + email)
                continue

            skip = False
            for n, v in users.iteritems():
                if v['email_addr'] == email:
                    skip = True
                    print('Already User: '******'INVITING: ' + email)
            m.redis.hset(
                'h:invites', email,
                json.dumps({
                    'email': email,
                    'desc': 'from letmeknow list',
                    'name': email
                }))

            do_invite(m, email, 'templates/emailinvite2.html')
Пример #4
0
 def delete_invite(self, email):
     table = RedisTable(self.redis, 'h:invites')
     try:
         archive_invites = RedisTable(self.redis, 'h:arc_invites')
         archive_invites[email] = table[email]
     except:
         pass
     del table[email]
Пример #5
0
    def has_user_email(self, email):
        #TODO: implement a email table, if needed?
        all_users = RedisTable(self.redis, 'h:users')
        for n, userdata in all_users.iteritems():
            if userdata['email_addr'] == email:
                return True

        return False
Пример #6
0
    def has_user_email(self, email):
        #TODO: implement a email table, if needed?
        all_users = RedisTable(self.redis, 'h:users')
        for n, userdata in all_users.iteritems():
            if userdata['email_addr'] == email:
                return True

        return False
Пример #7
0
def list_not_invited(m, invite=False):
    invites = RedisTable(m.redis, 'h:invites')
    for email, v in invites.iteritems():
        if 'sent' not in v:
            print(email + ': ' + v.get('name', '') + ' -- ' +
                  v.get('desc', ''))
            if invite:
                do_invite(m, email)
Пример #8
0
    def save_invite(self, email, name, desc=''):
        if not email or not name:
            return False

        table = RedisTable(self.redis, 'h:invites')
        table[email] = {'name': name, 'email': email, 'desc': desc}
        return True
Пример #9
0
    def is_valid_invite(self, invitekey):
        try:
            if not invitekey:
                return False

            key = base64.b64decode(invitekey)
            key.split(':', 1)
            email, hash_ = key.split(':', 1)

            table = RedisTable(self.redis, 'h:invites')
            entry = table[email]

            if entry and entry.get('hash_') == hash_:
                return email
        except Exception as e:
            print(e)
            pass

        msg = 'Sorry, that is not a valid invite code. Please try again or request another invite'
        raise ValidationException(msg)
Пример #10
0
    def send_invite(self, email, email_template, host):
        table = RedisTable(self.redis, 'h:invites')
        entry = table[email]
        if not entry:
            print('No Such Email In Invite List')
            return False

        hash_ = base64.b64encode(os.urandom(21))
        entry['hash_'] = hash_

        invitekey = base64.b64encode(email + ':' + hash_)

        email_text = template(
            email_template,
            host=host,
            email_addr=email,
            name=entry.get('name', email),
            invite=invitekey,
        )
        self.cork.mailer.send_email(
            email, 'You are invited to join webrecorder.io beta!', email_text)
        entry['sent'] = str(datetime.utcnow())
        return True
Пример #11
0
 def _get_user_colls(self, user):
     return RedisTable(self.redis, self._user_key(user) + self.COLL_KEY)
Пример #12
0
def list_not_invited(m):
    invites = RedisTable(m.redis, 'h:invites')
    for n, v in invites.iteritems():
        if 'sent' not in v:
            print n + ': ' + v.get('name', '') + ' -- ' + v.get('desc', '')
Пример #13
0
def list_not_invited(m):
    invites = RedisTable(m.redis, 'h:invites')
    for n, v in invites.iteritems():
        if 'sent' not in v:
            print n + ': ' + v.get('name', '') + ' -- ' + v.get('desc', '')