Skip to content

Commit 8af6fa6

Browse files
committed
Add 2FA form element to CP Users form
1 parent 2f2b15c commit 8af6fa6

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

interface/web/admin/form/users.tform.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@
9494
}
9595
}
9696

97+
$otp_method_list = array(
98+
'none' => 'none',
99+
'email' => 'email',
100+
);
101+
97102
//* Load themes
98103
$themes_list = array();
99104
$handle = @opendir(ISPC_THEMES_PATH);
@@ -254,6 +259,25 @@
254259
'rows' => '',
255260
'cols' => ''
256261
),
262+
'otp_type' => array(
263+
'datatype' => 'VARCHAR',
264+
'formtype' => 'SELECT',
265+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
266+
'errmsg'=> 'otp_auth_empty'),
267+
1 => array ( 'type' => 'REGEX',
268+
'regex' => '/^[a-z0-9\_]{0,64}$/',
269+
'errmsg'=> 'otp_auth_regex'),
270+
),
271+
'regex' => '',
272+
'errmsg' => '',
273+
'default' => '',
274+
'value' => $otp_method_list,
275+
'separator' => '',
276+
'width' => '30',
277+
'maxlength' => '255',
278+
'rows' => '',
279+
'cols' => ''
280+
),
257281
'language' => array (
258282
'datatype' => 'VARCHAR',
259283
'formtype' => 'SELECT',

interface/web/admin/lib/lang/en_users.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ $wb['startmodule_empty'] = 'Startmodule empty.';
3838
$wb['startmodule_regex'] = 'Invalid chars in Startmodule.';
3939
$wb['app_theme_empty'] = 'App theme empty.';
4040
$wb['app_theme_regex'] = 'Invalid chars in App theme.';
41+
$wb['otp_auth_txt'] = '2-Factor Authentication';
4142
?>

interface/web/admin/templates/users_user_edit.htm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
<div id="confirmpasswordOK" style="display:none;" class="confirmpasswordok">{tmpl_var name='password_match_txt'}</div>
2929
</div>
3030
</div>
31+
<div class="form-group">
32+
<label for="2fa" class="col-sm-3 control-label">{tmpl_var name='otp_auth_txt'}</label>
33+
<div class="col-sm-9">
34+
<select name="otp_type" id="otp_type" class="form-control">
35+
{tmpl_var name='otp_type'}
36+
</select>
37+
</div>
38+
</div>
39+
3140
<div class="form-group">
3241
<label class="col-sm-3 control-label">{tmpl_var name='modules_txt'}</label>
3342
<div class="col-sm-9">

0 commit comments

Comments
 (0)