Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    The plugin use the value inside cas:user tag in xml CAS Server response to validate user. So, if cas:user tag contains user email, it’s good.

    Best regards.

    Thread Starter anfieldleung

    (@anfieldleung)

    Hi,

    The value of cas:user tag will validate with WP email but not uesrname?

    No, cas:user tag will validate with WP user_login value.(WordPress pre-existing accounts) If user already exist in WordPress before WP Cassify plugin activation, you van perform an SQL update query to update WP user_login with user_email.
    If WordPress user account does not yet exist, you can check option “create user if not exist”. Then WordPress user account will ne created with cas:user tag value as user_login (So email in your case).

    Thread Starter anfieldleung

    (@anfieldleung)

    Thanks, that is what I understand.
    So my question is can I use the cas:user tag to validate with WordPress user_email?
    If not, any impact if I update the user_login with user_email since it is restricted with lowercase character and number only in WordPress Multisite by default. There should be some reason behind that prohibited to do so?

    I don’t know if it answer to you question but i try anyway.

    I think it’seems to be possible with hack the plugin code.
    But it assume that you return email in cas:user tag.

    You can try to replace function code like this (the function is located in classes/wp_cassify_utils.php) :

    public static function wp_cassify_auth_user_wordpress( $cas_user_id ) {
    
    		if ( email_exists( $cas_user_id ) ) {
    			$user = get_user_by( 'email', $cas_user_id );
    
    			wp_set_current_user( $user->ID, $user->user_login );
    			wp_set_auth_cookie( $user->ID );
    
    			do_action( 'wp_login', $user->user_login );
    		}
    		else {
    			die( 'User account does not exists in WordPress database !');
    		}
    	}

    Best regards.

    Thread Starter anfieldleung

    (@anfieldleung)

    Thanks a lot! Will try with method you suggest.

    Thread Starter anfieldleung

    (@anfieldleung)

    I tried with the suggested modification above and it works as expected. Thanks a lot.
    My last question is , how can I prevent the logic within this function will not be overridden if there are any update of the plugin in future?

    Thread Starter anfieldleung

    (@anfieldleung)

    Hi Alain-Aymerick,

    Is there any hook for wp_cassify_auth_user_wordpress function so that I can build my own function and replace with existing one? Or else, is there any way to keep my own modified wp_cassify_auth_user_wordpress function not being overridden even there is update of WP Cassify?
    Sorry I am quite green on WP development. Thanks your support!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Email login’ is closed to new replies.