通达OA 同时使用域帐号和OA内置帐号登录系统 .
通达OA支持域帐号绑定登录验证,在启用域验证后,但如果用户的OA帐号和域帐号不相同时,难免在OA登录页面输入域帐号,这样系统就提示登录失败。
经过以下修改,即可达到 OA帐号 和 域帐号 同时登录使用。
1. 新增一个 domainlogih.php 放在webroot根目录下
[php]
- <?
- include_once( "inc/conn.php" );
- if ( $UNAME != "" )
- {
- global $connection;
- $query = "select USER_ID from USER_MAP where USER_ID='".$UNAME."'";
- $cursor1 = exequery( $connection, $query );
- if (!($ROW1 = mysql_fetch_array( $cursor1 )) )
- {
- include_once( "inc/td_core.php" );
- include_once( "inc/utility.php" );
- include_once( "inc/ldap/adLDAP.php" );
- $SYNC_CONFIG = get_sys_para( "DOMAIN_SYNC_CONFIG" );
- $SYNC_CONFIG = unserialize( $SYNC_CONFIG['DOMAIN_SYNC_CONFIG'] );
- $option = get_ldap_option( $SYNC_CONFIG );
- $adldap = new adLDAP( $option );
- if ( !$adldap->authenticate( $SYNC_CONFIG['AD_USER'], $SYNC_CONFIG['AD_PWD'] ) )
- {
- message( "", _( "モ犹リイホハノ靹テモミホ・" ).$adldap->get_last_error( ).")" );
- exit( );
- }
- $user_info = $adldap->user_info( $USER_GUID, array( "objectsid" ), FALSE );
- $user_info = $adldap->user_info( iconv( ini_get( "default_charset" ), "utf-8", $UNAME ), array( "objectguid" ) );
- if ( $user_info === FALSE )
- {
- message( "", _( "サ。モテサァ[".$DOMAIN_USER."]ミナマ「ウ・" ).$adldap->get_last_error( ).")" );
- exit( );
- }
- $user_info = $user_info[0];
- if ( is_array( $user_info ) || is_array( $user_info['objectguid'] ) || $user_info['objectguid'][0] != "" )
- {
- $USER_GUID = bin2guid( $user_info['objectguid'][0] );
- $query = "select USER_ID from USER_MAP where USER_GUID='".$USER_GUID."'";
- $cursor1 = exequery( $connection, $query );
- if ( $ROW1 = mysql_fetch_array( $cursor1 ) )
- {
- $UNAME = $ROW1['USER_ID'];
- }
- }
- }
- }
- include_once( "logincheck.php" );
- ?>
<?
include_once( "inc/conn.php" );
if ( $UNAME != "" )
{
global $connection;
$query = "select USER_ID from USER_MAP where USER_ID='".$UNAME."'";
$cursor1 = exequery( $connection, $query );
if (!($ROW1 = mysql_fetch_array( $cursor1 )) )
{
include_once( "inc/td_core.php" );
include_once( "inc/utility.php" );
include_once( "inc/ldap/adLDAP.php" );
$SYNC_CONFIG = get_sys_para( "DOMAIN_SYNC_CONFIG" );
$SYNC_CONFIG = unserialize( $SYNC_CONFIG['DOMAIN_SYNC_CONFIG'] );
$option = get_ldap_option( $SYNC_CONFIG );
$adldap = new adLDAP( $option );
if ( !$adldap->authenticate( $SYNC_CONFIG['AD_USER'], $SYNC_CONFIG['AD_PWD'] ) )
{
message( "", _( "モ犹リイホハノ靹テモミホ・" ).$adldap->get_last_error( ).")" );
exit( );
}
$user_info = $adldap->user_info( $USER_GUID, array( "objectsid" ), FALSE );
$user_info = $adldap->user_info( iconv( ini_get( "default_charset" ), "utf-8", $UNAME ), array( "objectguid" ) );
if ( $user_info === FALSE )
{
message( "", _( "サ。モテサァ[".$DOMAIN_USER."]ミナマ「ウ・" ).$adldap->get_last_error( ).")" );
exit( );
}
$user_info = $user_info[0];
if ( is_array( $user_info ) || is_array( $user_info['objectguid'] ) || $user_info['objectguid'][0] != "" )
{
$USER_GUID = bin2guid( $user_info['objectguid'][0] );
$query = "select USER_ID from USER_MAP where USER_GUID='".$USER_GUID."'";
$cursor1 = exequery( $connection, $query );
if ( $ROW1 = mysql_fetch_array( $cursor1 ) )
{
$UNAME = $ROW1['USER_ID'];
}
}
}
}
include_once( "logincheck.php" );
?>
2. 把 templates 目录下的子目录 index.html 文件的表单Action更改为 domainlogin.php (原来是logincheck.php)
[html]
- <form name="form1" method="post" action="domainlogin.php" {autocomplete} onsubmit="{form_submit}">
- <table cellspacing="0" cellpadding="0" align="center">
- <tr class="img_field">
- <td align="center">{logo_img}</td>
- </tr>
- <tr height="37" class="login_field">
- <td align="center">
- <b>用户名</b> <input type="text" class="text" name="UNAME" size="15" onmouseover="this.focus()" onfocus="this.select()" value="{username_cookie}">
- <b>密码</b> <input type="password" class="text" name="PASSWORD" onmouseover="this.focus()" onfocus="this.select()" size="15" value="">
- <input type="submit" name="submit" class="submit" value="登 录">
- </td>
- </tr>
- </table>
- <br>{usb_key_option}
- {usbkey_object}
- </form>
<form name="form1" method="post" action="domainlogin.php" {autocomplete} οnsubmit="{form_submit}">
<table cellspacing="0" cellpadding="0" align="center">
<tr class="img_field">
<td align="center">{logo_img}</td>
</tr>
<tr height="37" class="login_field">
<td align="center">
<b>用户名</b> <input type="text" class="text" name="UNAME" size="15" οnmοuseοver="this.focus()" οnfοcus="this.select()" value="{username_cookie}">
<b>密码</b> <input type="password" class="text" name="PASSWORD" οnmοuseοver="this.focus()" οnfοcus="this.select()" size="15" value="">
<input type="submit" name="submit" class="submit" value="登 录">
</td>
</tr>
</table>
<br>{usb_key_option}
{usbkey_object}
</form>
templates下有多个子目录,都需要把 index.html按上述方面更改。
保存就可以实现无论使用域帐号还是OA的帐号,都可以登录系统。