mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-27 17:50:15 +00:00
Merge "Couple of fixme comments"
This commit is contained in:
commit
4179be3c42
|
@ -48,4 +48,5 @@ $messages['en'] = array(
|
||||||
* @author Ryan Lane <rlane@wikimedia.org>
|
* @author Ryan Lane <rlane@wikimedia.org>
|
||||||
*/
|
*/
|
||||||
$messages['qqq'] = array(
|
$messages['qqq'] = array(
|
||||||
|
'oathauth-desc' => '{{desc}}',
|
||||||
);
|
);
|
||||||
|
|
33
OATHUser.php
33
OATHUser.php
|
@ -14,11 +14,14 @@ class OATHUser {
|
||||||
/**
|
/**
|
||||||
* Constructor. Can't be called directly. Call one of the static NewFrom* methods
|
* Constructor. Can't be called directly. Call one of the static NewFrom* methods
|
||||||
* @param $id Int Database id for the group
|
* @param $id Int Database id for the group
|
||||||
* @param $name String User-defined name of the group
|
* @param $account
|
||||||
* @param $position int
|
* @param $secret
|
||||||
* @param $project string|null
|
* @param $secretReset
|
||||||
|
* @param $scratchTokens
|
||||||
|
* @param $scratchTokensReset
|
||||||
|
* @param bool $isValidated bool
|
||||||
*/
|
*/
|
||||||
public function __construct( $id, $account, $secret=null, $secretReset = null, $scratchTokens=null, $scratchTokensReset=null, $isValidated=false ) {
|
public function __construct( $id, $account, $secret = null, $secretReset = null, $scratchTokens = null, $scratchTokensReset = null, $isValidated = false ) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->account = $account;
|
$this->account = $account;
|
||||||
$this->isEnabled = true;
|
$this->isEnabled = true;
|
||||||
|
@ -36,7 +39,7 @@ class OATHUser {
|
||||||
if ( $scratchTokens ) {
|
if ( $scratchTokens ) {
|
||||||
$this->scratchTokens = $scratchTokens;
|
$this->scratchTokens = $scratchTokens;
|
||||||
} else {
|
} else {
|
||||||
$this->regenerateScratchTokens();
|
$this->regenerateScratchTokens(); // FIXME: Missing parameter
|
||||||
$this->isEnabled = false;
|
$this->isEnabled = false;
|
||||||
}
|
}
|
||||||
if ( $scratchTokensReset ) {
|
if ( $scratchTokensReset ) {
|
||||||
|
@ -47,6 +50,9 @@ class OATHUser {
|
||||||
$this->isValidated = $isValidated;
|
$this->isValidated = $isValidated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $reset bool
|
||||||
|
*/
|
||||||
public function regenerateScratchTokens( $reset ) {
|
public function regenerateScratchTokens( $reset ) {
|
||||||
$scratchTokens = array();
|
$scratchTokens = array();
|
||||||
for ( $i = 0; $i < 5; $i++ ) {
|
for ( $i = 0; $i < 5; $i++ ) {
|
||||||
|
@ -109,10 +115,12 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $token
|
||||||
|
* @param $reset bool
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function verifyToken( $token, $reset=false ) {
|
public function verifyToken( $token, $reset = false ) {
|
||||||
if ( $reset ) {
|
if ( $reset ) {
|
||||||
$secret = $this->secretReset;
|
$secret = $this->secretReset;
|
||||||
} else {
|
} else {
|
||||||
$secret = $this->secret;
|
$secret = $this->secret;
|
||||||
|
@ -139,7 +147,7 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name string
|
* @param $user User
|
||||||
* @return OATHUser|null
|
* @return OATHUser|null
|
||||||
*/
|
*/
|
||||||
public static function newFromUser( $user ) {
|
public static function newFromUser( $user ) {
|
||||||
|
@ -180,7 +188,7 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name string
|
* @param $username string
|
||||||
* @return OATHUser|null
|
* @return OATHUser|null
|
||||||
*/
|
*/
|
||||||
public static function newFromUsername( $username ) {
|
public static function newFromUsername( $username ) {
|
||||||
|
@ -228,7 +236,7 @@ class OATHUser {
|
||||||
array( 'secret' => $this->secretReset,
|
array( 'secret' => $this->secretReset,
|
||||||
'secret_reset' => null,
|
'secret_reset' => null,
|
||||||
'scratch_tokens' => base64_encode( serialize( $this->scratchTokensReset ) ),
|
'scratch_tokens' => base64_encode( serialize( $this->scratchTokensReset ) ),
|
||||||
'scratch_tokens_reset' => null,
|
'scratch_tokens_reset' => null,
|
||||||
),
|
),
|
||||||
array( 'id' => $this->id ),
|
array( 'id' => $this->id ),
|
||||||
__METHOD__
|
__METHOD__
|
||||||
|
@ -236,7 +244,6 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $token string
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validate() {
|
public function validate() {
|
||||||
|
@ -263,7 +270,6 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id int
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function disable() {
|
public function disable() {
|
||||||
|
@ -276,11 +282,11 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
|
||||||
* @param $template
|
* @param $template
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function ModifyUITemplate( &$template ) {
|
static function ModifyUITemplate( &$template ) {
|
||||||
|
// FIXME: First assignment of $input unused
|
||||||
$input = array( 'msg' => 'oathauth-token', 'type' => 'text', 'name' => 'token', 'value' => '', 'helptext' => 'oathauth-tokenhelp' );
|
$input = array( 'msg' => 'oathauth-token', 'type' => 'text', 'name' => 'token', 'value' => '', 'helptext' => 'oathauth-tokenhelp' );
|
||||||
$input = '<td class="mw-label"><label for="wpOATHToken">' . wfMsgHtml( 'oathauth-token' ) . '</label></td><td class="mw-input">' . Html::input( 'wpOATHToken', null, 'password', array( 'class' => 'loginPassword', 'id' => 'wpOATHToken', 'tabindex' => '2', 'size' => '20' ) ) . '</td>';
|
$input = '<td class="mw-label"><label for="wpOATHToken">' . wfMsgHtml( 'oathauth-token' ) . '</label></td><td class="mw-input">' . Html::input( 'wpOATHToken', null, 'password', array( 'class' => 'loginPassword', 'id' => 'wpOATHToken', 'tabindex' => '2', 'size' => '20' ) ) . '</td>';
|
||||||
$template->set( 'extrafields', $input );
|
$template->set( 'extrafields', $input );
|
||||||
|
@ -289,7 +295,6 @@ class OATHUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
|
||||||
* @param $username string
|
* @param $username string
|
||||||
* @param $password string
|
* @param $password string
|
||||||
* @param $result bool
|
* @param $result bool
|
||||||
|
|
|
@ -76,7 +76,10 @@ class SpecialOATH extends SpecialPage {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function displaySecret( $reset=false ) {
|
/**
|
||||||
|
* @param $reset bool
|
||||||
|
*/
|
||||||
|
function displaySecret( $reset = false ) {
|
||||||
$this->getOutput()->addModules( 'ext.oathauth' );
|
$this->getOutput()->addModules( 'ext.oathauth' );
|
||||||
if ( $reset ) {
|
if ( $reset ) {
|
||||||
$secret = $this->OATHUser->getSecretReset();
|
$secret = $this->OATHUser->getSecretReset();
|
||||||
|
@ -198,6 +201,10 @@ class SpecialOATH extends SpecialPage {
|
||||||
$this->getOutput()->addHTML( $this->createResourceList( $resources ) );
|
$this->getOutput()->addHTML( $this->createResourceList( $resources ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $resources array
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function createResourceList( $resources ) {
|
function createResourceList( $resources ) {
|
||||||
$resourceList = '';
|
$resourceList = '';
|
||||||
foreach ( $resources as $resource ) {
|
foreach ( $resources as $resource ) {
|
||||||
|
@ -207,8 +214,8 @@ class SpecialOATH extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $formData
|
* @param $formData array
|
||||||
* @param string $entryPoint
|
* @param $entryPoint string
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function tryValidateSubmit( $formData, $entryPoint = 'internal' ) {
|
function tryValidateSubmit( $formData, $entryPoint = 'internal' ) {
|
||||||
|
@ -246,8 +253,8 @@ class SpecialOATH extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $formData
|
* @param $formData array
|
||||||
* @param string $entryPoint
|
* @param $entryPoint string
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function tryDisableSubmit( $formData, $entryPoint = 'internal' ) {
|
function tryDisableSubmit( $formData, $entryPoint = 'internal' ) {
|
||||||
|
@ -268,8 +275,8 @@ class SpecialOATH extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $formData
|
* @param $formData array
|
||||||
* @param string $entryPoint
|
* @param $entryPoint string
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function tryResetSubmit( $formData, $entryPoint = 'internal' ) {
|
function tryResetSubmit( $formData, $entryPoint = 'internal' ) {
|
||||||
|
|
Loading…
Reference in a new issue