Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: Logging in Programmatically Problem Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
emiliodeme
Newbie
Newbie


Joined: 03 May 2012
Online Status: Offline
Posts: 9
Posted: 17 May 2012 at 10:35pm | IP Logged Quote emiliodeme

Hi there!

Using this example Logging in Programmatically I made a custom login for my website, but using correct authentication data it returns the following message "Authentication failed".

What can it be?

int.php code
Quote:
<?php
// Example of logging into WebMail account using email and password for incorporating into another web application

// determining main directory
defined('WM_ROOTPATH') || define('WM_ROOTPATH', (dirname(__FILE__).'/'));

// utilizing WebMail Pro API
include_once WM_ROOTPATH.'libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid())
{
// data for logging into account
$sEmail = $_POST['email'];
$sPassword = $_POST['password'];

// Getting required API class
$oApiWebMailManager = CApi::Manager('webmail');

// attempting to obtain object for account we're trying to log into
$oAccount = $oApiWebMailManager->LoginToAccount($sEmail, $sPassword);
if ($oAccount)
{
    // populating session data from the account
    $oAccount->FillSession();

    // redirecting to WebMail
    $oApiWebMailManager->JumpToWebMail('../webmail.php?check=1');
}
else
{
    // login error
    echo $oApiWebMailManager->GetLastErrorMessage();
}
}
else
{
echo 'WebMail API not allowed';
}


form code:
ps: adress was hidden, but int.php path is correct.
Quote:

<?php
     }
     
          $title = apply_filters('widget_title', $instance['title'] );
          if ( isset($instance['id']) ) $id = $instance['id'];
          $sEmail = __('Login *', 'brave');
          $sPassword = __('Senha *', 'brave');
          $entrar = __('Entrar', 'brave');
          $erro = __('Erro! Login ou senha incorretos.', 'brave');

          echo $before_widget;
             if ( $title ) echo $before_title . $title . $after_title;
          echo '<div><form id="quickcontact" method="post" action="http://www.*********************/mail/int.php">
                    <input type="text" name="name" id="quickcontact_name" class="requiredfield" onFocus="if(this.value == \''.$sEmail.'\') { this.value = \'\'; }" onBlur="if(this.value == \'\') { this.value = \''.$sEmail.'\'; }" value=\''.$sEmail.'\'/>
                    <input type="password" name="email" id="quickcontact_email" class="requiredfield" onFocus="if(this.value == \''.$sPassword.'\') { this.value = \'\'; }" onBlur="if(this.value == \'\') { this.value = \''.$sPassword.'\'; }" value=\''.$sPassword.'\'/>
                    <button type="submit" name="submit" value="Enter">'.$entrar.'</button>
                    <span class="errormessage">'.$erro.'</span>    
               </form></div>';
Back to Top View emiliodeme's Profile Search for other posts by emiliodeme
 
daisyemma
Newbie
Newbie
Avatar

Joined: 18 May 2012
Online Status: Offline
Posts: 1
Posted: 18 May 2012 at 1:51am | IP Logged Quote daisyemma

The content is professional,could you explain again for me?
Back to Top View daisyemma's Profile Search for other posts by daisyemma Visit daisyemma's Homepage
 
emiliodeme
Newbie
Newbie


Joined: 03 May 2012
Online Status: Offline
Posts: 9
Posted: 18 May 2012 at 6:19am | IP Logged Quote emiliodeme

daisyemma wrote:
The content is professional,could you explain again for me?


To simplify, I am using this code inside a widget inside wordpress... it's a php form following the instructions of Logging in programmatically.
Back to Top View emiliodeme's Profile Search for other posts by emiliodeme
 
emiliodeme
Newbie
Newbie


Joined: 03 May 2012
Online Status: Offline
Posts: 9
Posted: 21 May 2012 at 1:10pm | IP Logged Quote emiliodeme

Problem solved, code error, the name field was pointing incorrect values. THey are red colored bellow... the first one was supposed to be "email" and the second one "password".

Thanks,
Emilio

Quote:

<?php
     }
     
          $title = apply_filters('widget_title', $instance['title'] );
          if ( isset($instance['id']) ) $id = $instance['id'];
          $sEmail = __('Login *', 'brave');
          $sPassword = __('Senha *', 'brave');
          $entrar = __('Entrar', 'brave');
          $erro = __('Erro! Login ou senha incorretos.', 'brave');

          echo $before_widget;
             if ( $title ) echo $before_title . $title . $after_title;
          echo '<div><form id="quickcontact" method="post" action="http://www.*********************/mail/int.php">
                    <input type="text" name="name" id="quickcontact_name" class="requiredfield" onFocus="if(this.value == \''.$sEmail.'\') { this.value = \'\'; }" onBlur="if(this.value == \'\') { this.value = \''.$sEmail.'\'; }" value=\''.$sEmail.'\'/>
                    <input type="password" name="email" id="quickcontact_email" class="requiredfield" onFocus="if(this.value == \''.$sPassword.'\') { this.value = \'\'; }" onBlur="if(this.value == \'\') { this.value = \''.$sPassword.'\'; }" value=\''.$sPassword.'\'/>
                    <button type="submit" name="submit" value="Enter">'.$entrar.'</button>
                    <span class="errormessage">'.$erro.'</span>    
               </form></div>';
[/QUOTE]
Back to Top View emiliodeme's Profile Search for other posts by emiliodeme
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide