Skip to content

Commit 5bbec2b

Browse files
author
Marius Burkard
committed
Merge branch '2558-two-factor-authentication' into 'develop'
Resolve "Two-factor authentication" Closes #2558 See merge request ispconfig/ispconfig3!1575
2 parents 80d3a53 + 0904fa4 commit 5bbec2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+633
-15
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `sys_user` ADD `otp_type` SET('none', 'email') NOT NULL DEFAULT 'none' AFTER `lost_password_reqtime`, ADD `otp_data` VARCHAR(255) NULL AFTER `otp_type`, ADD `otp_recovery` VARCHAR(64) NULL AFTER `otp_data`, ADD `otp_attempts` TINYINT NOT NULL DEFAULT '0' AFTER `otp_recovery`;

install/sql/ispconfig3.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,10 @@ CREATE TABLE `sys_user` (
18421842
`lost_password_function` tinyint(1) NOT NULL default '1',
18431843
`lost_password_hash` VARCHAR(50) NOT NULL default '',
18441844
`lost_password_reqtime` DATETIME NULL default NULL,
1845+
`otp_type` set('none', 'email') NOT NULL DEFAULT 'none',
1846+
`otp_data` varchar(255) DEFAULT NULL,
1847+
`otp_recovery` varchar(64) DEFAULT NULL,
1848+
`otp_attempts` tinyint(4) NOT NULL DEFAULT 0,
18451849
PRIMARY KEY (`userid`)
18461850
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
18471851

interface/lib/app.inc.php

100755100644
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ public function log($msg, $priority = 0) {
212212
}
213213
}
214214

215+
public function auth_log($msg) {
216+
$authlog_handle = fopen($this->_conf['ispconfig_log_dir'].'/auth.log', 'a');
217+
fwrite($authlog_handle, $msg . PHP_EOL);
218+
fclose($authlog_handle);
219+
}
220+
215221
/** Priority values are: 0 = DEBUG, 1 = WARNING, 2 = ERROR */
216222
public function error($msg, $next_link = '', $stop = true, $priority = 1) {
217223
//$this->uses("error");

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/ar_users.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ $wb['username_error_collision'] = 'The username may not be web or web plus a num
3434
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
3535
$wb['lost_password_function_txt'] = 'Forgot password function is available';
3636
$wb['no_user_insert'] = 'CP-Users of type -user- get added and updated automatically when you add a client or reseller.';
37+
$wb['otp_auth_txt'] = '2-Factor Authentication';
3738
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ $wb['username_error_collision'] = 'The username may not be web or web plus a num
3434
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
3535
$wb['lost_password_function_txt'] = 'Forgot password function is available';
3636
$wb['no_user_insert'] = 'CP-Users of type -user- get added and updated automatically when you add a client or reseller.';
37+
$wb['otp_auth_txt'] = '2-Factor Authentication';
3738
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ $wb['startmodule_empty'] = 'O módulo inicial está vazio.';
3838
$wb['startmodule_regex'] = 'Caracteres inválidos no módulo inicial.';
3939
$wb['app_theme_empty'] = 'Tema está vazio.';
4040
$wb['app_theme_regex'] = 'Caracteres inválidos no tema.';
41+
$wb['otp_auth_txt'] = '2-Factor Authentication';

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ $wb['username_error_collision'] = 'The username may not be web or web plus a num
3434
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
3535
$wb['lost_password_function_txt'] = 'Forgot password function is available';
3636
$wb['no_user_insert'] = 'CP-Users of type -user- get added and updated automatically when you add a client or reseller.';
37+
$wb['otp_auth_txt'] = '2-Factor Authentication';
3738
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ $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';

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ $wb['username_error_collision'] = 'Der Benutzername darf nicht <b>web<b> oder <b
3434
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
3535
$wb['lost_password_function_txt'] = 'Passwort vergessen Funktion steht zur Verfügung';
3636
$wb['no_user_insert'] = 'CP-Users of type -user- get added and updated automatically when you add a client or reseller.';
37+
$wb['otp_auth_txt'] = '2-Factor Authentication';
3738
?>

0 commit comments

Comments
 (0)