Skip to content

Require two factor authentication for the ACP login only not working #50

Description

@Greeniously

Bug in paul999\tfa\helper\session_helper.php

Missing code in public function is_tfa_required, between MODE_REQUIRED_FOR_ACP_LOGIN and MODE_REQUIRED_FOR_ADMIN, is basically making those settings identical.

return ($admin); should work?

Suggested solution:

	public function is_tfa_required($user_id, $admin = false, $userdata = array())
	{
		if (sizeof($this->get_modules()) == 0)
		{
			return false;
		}
		switch ($this->config['tfa_mode'])
		{
			case session_helper_interface::MODE_DISABLED:
				return false;

			case session_helper_interface::MODE_NOT_REQUIRED:
				return $this->is_tfa_registered($user_id);

			case session_helper_interface::MODE_REQUIRED_FOR_ACP_LOGIN:
				return ($admin);
				
			case session_helper_interface::MODE_REQUIRED_FOR_ADMIN:
				return $this->do_permission_check($user_id, $userdata, 'a_');

			case session_helper_interface::MODE_REQUIRED_FOR_MODERATOR:
				return $this->do_permission_check($user_id, $userdata, array('m_', 'a_'));

			case session_helper_interface::MODE_REQUIRED:
				return true;

			default:
				return false;
		}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions