Hi Omar,
You might have to implment a custom request handler for your case see: https://www.mendix.com/blog/requesthandlers-at-your-service/ or https://forum.mendix.com/index3.html.
Call Core.Login instead of Core.Logout.
Alternatively you may find the Custom Login widget or OAuth Module helpfull. If possible, a better solution may be to implement SSO with the SAML module.