function auth_attempt_script_login( $p_username, $p_password = null ) {
global $g_script_login_cookie, $g_cache_current_user_id;
$t_user_id = user_get_id_by_name( $p_username );
$t_user = user_get_row( $t_user_id );
# check for disabled account
if ( OFF == $t_user['enabled'] ) {
return false;
}
# validate password if supplied
if ( null !== $p_password ) {
if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
return false;
}
}