2012-05-07 21:54:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2014-05-22 07:33:40 +00:00
|
|
|
* Proxy page that redirects to the proper OATH special page
|
2012-05-07 21:54:44 +00:00
|
|
|
*/
|
2014-05-22 07:33:40 +00:00
|
|
|
class SpecialOATH extends ProxySpecialPage {
|
2014-05-11 08:16:03 +00:00
|
|
|
/**
|
2014-05-22 07:33:40 +00:00
|
|
|
* If the user already has OATH enabled, show them a page to disable
|
|
|
|
* If the user has OATH disabled, show them a page to enable
|
2014-05-11 08:16:03 +00:00
|
|
|
*
|
2016-11-12 02:48:49 +00:00
|
|
|
* @return SpecialOATHDisable|SpecialOATHEnable
|
2012-05-07 21:54:44 +00:00
|
|
|
*/
|
2014-05-22 07:33:40 +00:00
|
|
|
protected function getTargetPage() {
|
2015-05-25 23:47:03 +00:00
|
|
|
$repo = OATHAuthHooks::getOATHUserRepository();
|
2012-05-07 21:54:44 +00:00
|
|
|
|
2016-11-12 02:48:49 +00:00
|
|
|
$user = $repo->findByUser( $this->getUser() );
|
2014-05-27 18:00:21 +00:00
|
|
|
|
2016-11-12 02:48:49 +00:00
|
|
|
if ( $user->getKey() === null ) {
|
|
|
|
return new SpecialOATHEnable( $repo, $user );
|
2012-05-07 21:54:44 +00:00
|
|
|
} else {
|
2016-11-12 02:48:49 +00:00
|
|
|
return new SpecialOATHDisable( $repo, $user );
|
2012-05-07 21:54:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-23 18:57:40 +00:00
|
|
|
protected function getGroupName() {
|
|
|
|
return 'oath';
|
|
|
|
}
|
2012-05-07 21:54:44 +00:00
|
|
|
}
|