mediawiki-extensions-OATHAuth/OATHUser.php
Tyler Anthony Romeo 0c389f5025 Refactored special pages into HTMLForm and proxy
Made new class ProxySpecialPage, which acts as a
proxy object to another SpecialPage object that is
determined based on context information other than
the title.

Then Special:OATH has been split into two separate
special page classes (both FormSpecialPages using
HTMLForm) that are routed to by a ProxySpecialPage
object.

In addition, the form for enabling two-factor auth
has been refactored into vform style, with some
better instructions on how to enable two-factor
authentication.

Change-Id: Ib9117cbc9d7f044de9607db81a157e1b472b5ec0
2016-03-23 11:26:04 -07:00

56 lines
953 B
PHP

<?php
/**
* Class representing a user from OATH's perspective
*
* @ingroup Extensions
*/
class OATHUser {
/** @var User */
private $user;
/** @var OATHAuthKey|null */
private $key;
/**
* Constructor. Can't be called directly. Call one of the static NewFrom* methods
* @param User $user
* @param OATHAuthKey $key
*/
public function __construct( User $user, OATHAuthKey $key = null ) {
$this->user = $user;
$this->key = $key;
}
public function getUser() {
return $this->user;
}
/**
* @return String
*/
public function getAccount() {
global $wgSitename;
return "$wgSitename:{$this->user->getName()}";
}
/**
* Get the key associated with this user.
*
* @return null|OATHAuthKey
*/
public function getKey() {
return $this->key;
}
/**
* Set the key associated with this user.
*
* @param OATHAuthKey|null $key
*/
public function setKey( OATHAuthKey $key = null ) {
$this->key = $key;
}
}