mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-28 02:00:06 +00:00
Make sure key is of correct type before running operations on it
Bug: T231786 Change-Id: I54aad0753fa3eda48e7f382b27b1c89069f40d36
This commit is contained in:
parent
484241edf0
commit
ae53dc5c60
|
@ -5,10 +5,11 @@ namespace MediaWiki\Extension\OATHAuth\HTMLForm;
|
|||
use MediaWiki\Extension\OATHAuth\Key\TOTPKey;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use Html;
|
||||
use Status;
|
||||
|
||||
class TOTPEnableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
|
||||
/**
|
||||
* @param array|bool|\Status|string $submitResult
|
||||
* @param array|bool|Status|string $submitResult
|
||||
* @return string
|
||||
*/
|
||||
public function getHTML( $submitResult ) {
|
||||
|
@ -28,7 +29,7 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
|
|||
protected function getDescriptors() {
|
||||
$key = $this->getRequest()->getSessionData( 'oathauth_totp_key' );
|
||||
|
||||
if ( $key === null ) {
|
||||
if ( !$key instanceof TOTPKey ) {
|
||||
$key = TOTPKey::newFromRandom();
|
||||
$this->getRequest()->setSessionData( 'oathauth_totp_key', $key );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue