def _requirements(self, display_steps, is_active): """Determine which requirements to show the user. For example, if the user needs to submit a photo verification, tell the user that she will need a photo ID and a webcam. Arguments: display_steps (list): The steps to display to the user. is_active (bool): If False, adds a requirement to activate the user account. Returns: dict: Keys are requirement names, values are booleans indicating whether to show the requirement. """ all_requirements = { self.ACCOUNT_ACTIVATION_REQ: not is_active, self.PHOTO_ID_REQ: False, self.WEBCAM_REQ: False, } # Remove the account activation requirement if disabled via waffle if is_account_activation_requirement_disabled(): all_requirements.pop(self.ACCOUNT_ACTIVATION_REQ) display_steps = set(step['name'] for step in display_steps) for step, step_requirements in six.iteritems(self.STEP_REQUIREMENTS): if step in display_steps: for requirement in step_requirements: all_requirements[requirement] = True return all_requirements
def _requirements(self, display_steps, is_active): """Determine which requirements to show the user. For example, if the user needs to submit a photo verification, tell the user that she will need a photo ID and a webcam. Arguments: display_steps (list): The steps to display to the user. is_active (bool): If False, adds a requirement to activate the user account. Returns: dict: Keys are requirement names, values are booleans indicating whether to show the requirement. """ all_requirements = { self.ACCOUNT_ACTIVATION_REQ: not is_active, self.PHOTO_ID_REQ: False, self.WEBCAM_REQ: False, } # Remove the account activation requirement if disabled via waffle if is_account_activation_requirement_disabled(): all_requirements.pop(self.ACCOUNT_ACTIVATION_REQ) display_steps = set(step['name'] for step in display_steps) for step, step_requirements in self.STEP_REQUIREMENTS.iteritems(): if step in display_steps: for requirement in step_requirements: all_requirements[requirement] = True return all_requirements
def _get_user_active_status(self, user): """ Returns the user's active status to the caller Overrides the actual value if account activation has been disabled via waffle switch Arguments: user (User): Current user involved in the onboarding/verification flow """ return user.is_active or is_account_activation_requirement_disabled()
def _get_user_active_status(self, user): """ Returns the user's active status to the caller Overrides the actual value if account activation has been disabled via waffle switch Arguments: user (User): Current user involved in the onboarding/verification flow """ return user.is_active or is_account_activation_requirement_disabled()