Exemplo n.º 1
0
 /**
  * Initialize the API instance with the list of valid authentication methods supported.
  *
  * @return void
  */
 protected function postInitialize()
 {
     parent::postInitialize();
     $loginViaOption = $this->getVar(UsersConstant::MODVAR_LOGIN_METHOD, UsersConstant::LOGIN_METHOD_UNAME);
     // Register the uname authentication method
     $authenticationMethod = new AuthenticationMethodHelper($this->name, 'uname', $this->__('User name'), $this->__('User name and password'), true, "fa-user");
     if ($loginViaOption == UsersConstant::LOGIN_METHOD_UNAME) {
         $authenticationMethod->enableForAuthentication();
         $authenticationMethod->enableForRegistration();
     } else {
         $authenticationMethod->disableForAuthentication();
         $authenticationMethod->disableForRegistration();
     }
     $this->authenticationMethods['uname'] = $authenticationMethod;
     // Register the email authentication method
     $authenticationMethod = new AuthenticationMethodHelper($this->name, 'email', $this->__('E-mail address'), $this->__('E-mail address and password'), true, "fa-envelope");
     if ($loginViaOption == UsersConstant::LOGIN_METHOD_EMAIL) {
         $authenticationMethod->enableForAuthentication();
         $authenticationMethod->enableForRegistration();
     } else {
         $authenticationMethod->disableForAuthentication();
         $authenticationMethod->disableForRegistration();
     }
     $this->authenticationMethods['email'] = $authenticationMethod;
     // Register the unameoremail authentication method
     $authenticationMethod = new AuthenticationMethodHelper($this->name, 'unameoremail', $this->__('User name or e-mail'), $this->__('User name / e-mail address and password'), true, "fa-user");
     if ($loginViaOption == UsersConstant::LOGIN_METHOD_ANY) {
         $authenticationMethod->enableForAuthentication();
         $authenticationMethod->enableForRegistration();
     } else {
         $authenticationMethod->disableForAuthentication();
         $authenticationMethod->disableForRegistration();
     }
     $this->authenticationMethods['unameoremail'] = $authenticationMethod;
 }
Exemplo n.º 2
0
    /**
     * Initialize the API instance with the list of valid authentication methods supported.
     *
     * @return void
     */
    protected function  postInitialize()
    {
        parent::postInitialize();

        $loginViaOption = $this->getVar(Users_Constant::MODVAR_LOGIN_METHOD, Users_Constant::LOGIN_METHOD_UNAME);

        // Register the uname authentication method
        $authenticationMethod = new Users_Helper_AuthenticationMethod(
                $this->name,
                'uname',
                $this->__('User name'),
                $this->__('User name and password'),
                false
        );
        if (($loginViaOption == Users_Constant::LOGIN_METHOD_UNAME) || ($loginViaOption == Users_Constant::LOGIN_METHOD_ANY)) {
            $authenticationMethod->enableForAuthentication();
        } else {
            $authenticationMethod->disableForAuthentication();
        }
        $this->authenticationMethods['uname'] = $authenticationMethod;

        // Register the email authentication method
        $authenticationMethod = new Users_Helper_AuthenticationMethod(
                $this->name,
                'email',
                $this->__('E-mail address'),
                $this->__('E-mail address and password'),
                false
        );
        if (($loginViaOption == Users_Constant::LOGIN_METHOD_EMAIL) || ($loginViaOption == Users_Constant::LOGIN_METHOD_ANY)) {
            $authenticationMethod->enableForAuthentication();
        } else {
            $authenticationMethod->disableForAuthentication();
        }
        $this->authenticationMethods['email'] = $authenticationMethod;
    }