Skip to content

Commit 94a35e9

Browse files
committed
Save preferences bug fixed
1 parent 734a1f4 commit 94a35e9

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

extensions/Latch/LatchAccount.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,7 @@ function onPreferencesForm( $user, &$preferences )
7070
{
7171

7272
if( dbHelper::isPaired( ) ) //if the user is paired render the view with unpair options in the form
73-
{
74-
/*
75-
$preferences['formUnpairedTextbox'] = array(
76-
'type' => 'text',
77-
'section' => '2FA/Latch',
78-
'label-message' => 'prefs-2FA-label',
79-
'maxlength' => '6', //OTP is maximum 6 characters.
80-
'id'=>'pairingToken',
81-
);
82-
*/
73+
{
8374
$preferences['formPairedButton'] = array(
8475
'type' => 'submit',
8576
'section' => '2FA/Latch',//'2nd factor authentication
@@ -88,9 +79,7 @@ function onPreferencesForm( $user, &$preferences )
8879
);
8980

9081
}
91-
92-
93-
82+
9483
else //if the user is not paired render the view with pair options in the form
9584
{
9685
$preferences['formUnpairedTextbox'] = array(
@@ -119,10 +108,13 @@ function onPreferencesForm( $user, &$preferences )
119108
return true; // Required return value of a hook function.
120109
}
121110

111+
/**
112+
* Allows extension to modify what preferences will be saved
113+
*/
122114
function onPreferencesFormPreSave( $formData, $form, $user, &$result )
123115
{
124116
//the user has not paired Mediawiki account with Latch
125-
if( !dbHelper::isPaired() ) //&& isset( $_POST["formUniredButton"] ) )
117+
if( !dbHelper::isPaired() )
126118
{
127119
$oneTimePassword = $formData["formUnpairedTextbox"]; //get the OTP writen by the user in the textbox form
128120
LatchController::doPair($oneTimePassword);

0 commit comments

Comments
 (0)