import logging

from Products.CMFCore.utils import getToolByName


def upgrade_from_1_to_2(context, logger=None):
    if logger is None:
        # Called as upgrade step: define our own logger.
        logger = logging.getLogger('collective.twofactor')

    logger.info("Checking all site members to see if they have enabled sms "
                "auth, but did not provide a cell_phone")
    mt = getToolByName(context, 'portal_membership')
    for member in mt.listMembers():
        if member.getProperty('two_factor_method') == 'sms':
            if not member.getProperty('cell_phone'):
                member.setMemberProperties({'two_factor_hash': '',
                                            'two_factor_hash_date': '',
                                            'local_code': '',
                                            'local_code_date': '',
                                            'local_code_sent': False,
                                            'two_factor_method': ''})

                logger.info("Fixed user %s" % member.id)

    logger.info("All done.")

5fae8a10b690ce8569cfadde74a3193c3334b065
<mask token>

<mask token>


def upgrade_from_1_to_2(context, logger=None):
    if logger is None:
        logger = logging.getLogger('collective.twofactor')
    logger.info(
        'Checking all site members to see if they have enabled sms auth, but did not provide a cell_phone'
        )
    mt = getToolByName(context, 'portal_membership')
    for member in mt.listMembers():
        if member.getProperty('two_factor_method') == 'sms':
            if not member.getProperty('cell_phone'):
                member.setMemberProperties({'two_factor_hash': '',
                    'two_factor_hash_date': '', 'local_code': '',
                    'local_code_date': '', 'local_code_sent': False,
                    'two_factor_method': ''})
                logger.info('Fixed user %s' % member.id)
    logger.info('All done.')

import logging
from Products.CMFCore.utils import getToolByName


def upgrade_from_1_to_2(context, logger=None):
    if logger is None:
        logger = logging.getLogger('collective.twofactor')
    logger.info(
        'Checking all site members to see if they have enabled sms auth, but did not provide a cell_phone'
        )
    mt = getToolByName(context, 'portal_membership')
    for member in mt.listMembers():
        if member.getProperty('two_factor_method') == 'sms':
            if not member.getProperty('cell_phone'):
                member.setMemberProperties({'two_factor_hash': '',
                    'two_factor_hash_date': '', 'local_code': '',
                    'local_code_date': '', 'local_code_sent': False,
                    'two_factor_method': ''})
                logger.info('Fixed user %s' % member.id)
    logger.info('All done.')

import logging

from Products.CMFCore.utils import getToolByName


def upgrade_from_1_to_2(context, logger=None):
    if logger is None:
        # Called as upgrade step: define our own logger.
        logger = logging.getLogger('collective.twofactor')

    logger.info("Checking all site members to see if they have enabled sms "
                "auth, but did not provide a cell_phone")
    mt = getToolByName(context, 'portal_membership')
    for member in mt.listMembers():
        if member.getProperty('two_factor_method') == 'sms':
            if not member.getProperty('cell_phone'):
                member.setMemberProperties({'two_factor_hash': '',
                                            'two_factor_hash_date': '',
                                            'local_code': '',
                                            'local_code_date': '',
                                            'local_code_sent': False,
                                            'two_factor_method': ''})

                logger.info("Fixed user %s" % member.id)

    logger.info("All done.")
