Prevent infinite loop on logout, remove login form
This commit is contained in:
parent
112ecdb5a5
commit
fe95203969
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* Name: Proxy Auth
|
* Name: Proxy Auth
|
||||||
* Description: Authenticate a user against reverse proxy headers
|
* Description: Authenticate a user against reverse proxy headers
|
||||||
* Version: 1.0
|
* Version: 1.1
|
||||||
* Author: Mark Wane <https://social.cool110.xyz/profile/mark>
|
* Author: Mark Wane <https://social.cool110.xyz/profile/mark>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -21,11 +21,13 @@ use Friendica\Model\User;
|
||||||
|
|
||||||
function proxyauth_install(){
|
function proxyauth_install(){
|
||||||
Hook::register( 'authenticate', 'addon/proxyauth/proxyauth.php', 'proxyauth_hook' );
|
Hook::register( 'authenticate', 'addon/proxyauth/proxyauth.php', 'proxyauth_hook' );
|
||||||
|
Hook::register( 'login_hook', 'addon/proxyauth/proxyauth.php', 'proxyauth_login' );
|
||||||
Hook::register( 'logging_out', 'addon/proxyauth/proxyauth.php', 'proxyauth_logout' );
|
Hook::register( 'logging_out', 'addon/proxyauth/proxyauth.php', 'proxyauth_logout' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function proxyauth_uninstall(){
|
function proxyauth_uninstall(){
|
||||||
Hook::unregister( 'authenticate', 'addon/proxyauth/proxyauth.php', 'proxyauth_hook' );
|
Hook::unregister( 'authenticate', 'addon/proxyauth/proxyauth.php', 'proxyauth_hook' );
|
||||||
|
Hook::unregister( 'login_hook', 'addon/proxyauth/proxyauth.php', 'proxyauth_login' );
|
||||||
Hook::unregister( 'logging_out', 'addon/proxyauth/proxyauth.php', 'proxyauth_logout' );
|
Hook::unregister( 'logging_out', 'addon/proxyauth/proxyauth.php', 'proxyauth_logout' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +42,25 @@ function proxyauth_hook( $a, &$b ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function proxyauth_login( $a, &$o ){
|
||||||
|
$o = ' <form id="login-form" action="https://social.cool110.xyz/login" role="form" method="post">
|
||||||
|
<div id="login-group" role="group" aria-labelledby="login-head">
|
||||||
|
<input type="hidden" name="auth-params" value="login" />
|
||||||
|
<div id="login-submit-wrapper">
|
||||||
|
<input type="submit" name="submit" id="login-submit-button" value="Login with SSO" />
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="remember" value="0" />
|
||||||
|
</div>
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
|
||||||
function proxyauth_logout( $a ){
|
function proxyauth_logout( $a ){
|
||||||
DI::cookie()->clear();
|
DI::cookie()->clear();
|
||||||
DI::session()->clear();
|
DI::session()->clear();
|
||||||
info( DI::l10n()->t( 'Logging out') );
|
info( DI::l10n()->t( 'Logging out') );
|
||||||
DI::baseUrl()->redirect( '/logout_sso' );
|
if ( ! stripos( $_SERVER['HTTP_REFERER'], 'auth.cool110.xyz' ) ) {
|
||||||
|
DI::baseUrl()->redirect( '/logout_sso' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function proxyauth_auth(){
|
function proxyauth_auth(){
|
||||||
|
|
Loading…
Reference in a new issue