Beispiel #1
0
 def add_validation(self, uid, email):
     rtoken = ''.join([randchar() for i in range(26)])
     validation_record = {'uid': uid,
                          'created': time.time(),
                          'email': email}
     user_info = self._db.get('%s%s' % (self.USER_DB, uid))
     if user_info is None:
         logger.error("Could not find user record for uid %s" % uid)
         raise OIDStorageException("uid not found")
     try:
         user = cjson.decode(user_info)
     except (TypeError, EOFError), ex:
         logger.error("Unpickling error %s " % ex)
         raise (OIDStorageException("Storage error"))
Beispiel #2
0
 def add_validation(self, uid, email):
     rtoken = ''.join([randchar() for i in range(26)])
     validation_record = {u'uid': uid,
                          u'created': datetime.now(),
                          u'email': email}
     user = self._user_db.get(uid, None)
     if user is None:
         raise OIDStorageException("uid not found")
     if 'emails' not in user:
         user['emails'] = {}
     user['emails'][email.encode('ascii')] = \
             {'created': int(time.time()),
              'conf_code': rtoken,
              'state': 'pending'}
     self._user_db[uid] = user
     self._validate_db[rtoken] = validation_record
     return rtoken
 def _4chars():
     return ''.join([randchar(chars) for i in range(4)])
Beispiel #4
0
def get_nonce():
    now = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
    rand_chars = ''.join([randchar() for i in range(6)])
    return now + rand_chars
Beispiel #5
0
 def _4chars():
     return "".join([randchar(chars) for i in range(4)])