• Resolved harrykc

    (@harrykc)


    Hi, i have enabled this plugin and works well.

    But i do not check “Create user if not exist”, then the problem comes.

    If i login with authenticated user but this account not exist in wordpress then it shows “User account does not exists in WordPress database !”

    Then i go back to login page, it will show “User account does not exists in WordPress database !” again, because the CAS session still alive, so will redirect back to ?ticket=xx page.

    I need to type CAS logout link one times. or restart browser, then the CAS login page will show again.

    Have any way or hook to call CAS logout url if “User account does not exists in WordPress database !”?

    https://www.ads-software.com/plugins/wp-cassify/

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

    In new version 1.6.6, i’ve created a new custom hook. You can use like this in your functions.php (located inside your theme) or in another plugin file (loaded after wp-cassify plugin).

    add_action( ‘wp_cassify_before_auth_user_wordpress’, ‘custom_action_before_auth_user_wordpress’, 1, 1 );

    function custom_action_before_auth_user_wordpress( $cas_user_datas ) {

    if (! username_exists( $cas_user_datas[ ‘cas_user_id’ ] ) ) {
    $GLOBALS[‘wp-cassify’]->wp_cassify_logout();
    }
    }

    Keep me informed if it solved your problem.

    Best regards.

    Thread Starter harrykc

    (@harrykc)

    Hi,

    The action is works, but it will redirect to CAS logout page immediately, the message “User account does not exists in WordPress database !” will be skipped.

    Then, the user will not know the reason why auto logout immediately.

    Thread Starter harrykc

    (@harrykc)

    Sorry for one more question, i have installed another plugin called “WPS Hide Login” and update cms login url to xxx.com/login, then after CAS login, it redirect to xxx.com instead of xxx.com/login

    How to handle it?

    Hi,

    First of all, please re-post the seconde question in new thread, it would be clearly for another users.

    Okay, it’s normal that you’re redirected directly to standard CAS logout page. Probably, you’ve not configured your CAS server with “followServiceRedirects” option.
    https://jasig.github.io/cas/4.2.x/installation/Logout-Single-Signout.html

    • Deactivate WPS Hide Login plugin
    • Configure followServiceRedirects option in your CAS Server. Edit cas.properties file and then put this option to “true” like below.
    • Create a public page in your blog where your explain the reason of user logout : You’ve been disconnected because you’ve not local WordPress Account ! Please contact [email protected]
    • In WP Cassify admin page, in Authorization rules settings panel, put url of public logout page previously created in User not allowed redirect url field
    • Update changes

    In your cas.properties (On your CAS Server) :
    cas.logout.followServiceRedirects=true

    NB : If you leave empty User not allowed redirect url option, home_url() is used instead.

    Keep me informed if it solved your problem.

    Best regards.

    No reply 4 days ago. So, i close ticket.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Authenticated CAS user and uncheck Create user if not exist’ is closed to new replies.