Skip to content

Commit

Permalink
* Changed parameters for the ldap_* functions to use the p_user_id in…
Browse files Browse the repository at this point in the history
…stead of p_user_name, updated associated calls in other files.

* Now checking for non-empty LDAP email address in function user_get_email() - if empty, then go with the default from SQL.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1759 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
robertjf committed Jan 23, 2003
1 parent d8f1909 commit 1744f3b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions core/user_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: user_api.php,v 1.46 2003-01-23 00:33:15 vboctor Exp $
# $Id: user_api.php,v 1.47 2003-01-23 06:30:11 robertjf Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -242,19 +242,28 @@ function user_signup( $p_username, $p_email=null ) {
# Shouldn't we override an email that is passed in here?
# If the user doesn't exist in ldap, is the account created?
# If so, there password won't get set anywhere... (etc)

if ( ON == config_get( 'use_ldap_email' ) ) {
$p_email = ldap_email( $p_username );
} else {
$p_email = '';
# RJF: I was going to check for the existence of an LDAP email.
# however, since we can't create an LDAP account at the moment,
# and we don't know the user password in advance, we may not be able
# to retrieve it anyway.
# I'll re-enable this once a plan has been properly formulated for LDAP
# account management and creation.

$t_email = "";
/* if ( ON == config_get( 'use_ldap_email' ) ) {
$t_email = ldap_email_from_username( $p_username );
}
*/
if ( is_blank($t_email) ) {
$t_email = $p_email;
}
}

$t_seed = $p_email.$p_username;
$t_seed = $t_email.$p_username;
# Create random password
$t_password = auth_generate_random_password( $t_seed );

return user_create( $p_username, $t_password, $p_email );
return user_create( $p_username, $t_password, $t_email );
}

# --------------------
Expand Down Expand Up @@ -361,11 +370,14 @@ function user_get_field( $p_user_id, $p_field_name ) {
# --------------------
# lookup the user's email in LDAP or the db as appropriate
function user_get_email( $p_user_id ) {
$t_email = "";
if ( ON == config_get( 'use_ldap_email' ) ) {
return ldap_email( user_get_name( $p_user_id ) );
} else {
return user_get_field( $p_user_id, 'email' );
$t_email = ldap_email( $p_user_id );
}
if ( is_blank( $t_email ) ) {
$t_email = user_get_field( $p_user_id, 'email' );
}
return $t_email;
}

# --------------------
Expand Down

0 comments on commit 1744f3b

Please sign in to comment.