} } if ($type === 'edit' && !empty($password) || $type === 'add') { if (mb_strlen($password) < 6) { $errors['password'] = __('Password must contain at least 6 chars'); } if ($password !== $password2) { $errors['password2'] = __('Password confirmation is not the same'); } } if (count($errors) === 0) { if (empty($password)) { $password = null; } if ($roles === 'admin') { Sentinel::setAdmin($username, $password); if ($type === 'add') { Sentinel::log('addadmin ' . $username, $current_user); } } else { $logs = array(); foreach ($logfiles as $fileid => $access) { if (substr($fileid, 0, 2) === 'f-') { if ((int) $access === 1) { $logs[substr($fileid, 2)] = array('r' => true); } } else { if (substr($fileid, 0, 2) === 't-') { if ((int) $access === 1) { $tags[substr($fileid, 2)] = array('r' => true); }
break; /* |-------------------------------------------------------------------------- | Auth 3. Save data |-------------------------------------------------------------------------- | */ /* |-------------------------------------------------------------------------- | Auth 3. Save data |-------------------------------------------------------------------------- | */ case 'authsave': if (mb_strlen($_POST['u']) > 0 && mb_strlen($_POST['p']) >= 6) { Sentinel::setAdmin($_POST['u'], $_POST['p']); $return['notice'] = Sentinel::save(); } break; /* |-------------------------------------------------------------------------- | Logs 1. Check if $config_file already exists |-------------------------------------------------------------------------- | */ /* |-------------------------------------------------------------------------- | Logs 1. Check if $config_file already exists |-------------------------------------------------------------------------- | */
?> </div></div></div></div></div></div><div class="tab-pane" id="authactivation"><?php $return = ''; if (@$_POST['action'] === 'authactivation') { Sentinel::init(); Sentinel::create(); if (Sentinel::userExists($_POST['username'])) { $return = '<br/><div class="alert alert-danger" role="alert">' . sprintf(__('User %s already exists!'), '<code>' . $_POST['username'] . '</code>') . '</div>'; } else { if ($_POST['password'] !== $_POST['password2']) { $return = '<br/><div class="alert alert-danger" role="alert">' . __('Password confirmation is not the same') . '</div>'; } else { if (mb_strlen($_POST['password']) < 6) { $return = '<br/><div class="alert alert-danger" role="alert">' . __('Password must contain at least 6 chars') . '</div>'; } else { Sentinel::setAdmin($_POST['username'], $_POST['password']); Sentinel::save(); $return = '<br/><div class="alert alert-success" role="alert">' . __('Authentication has been enabled and admin account has been created!') . '</div>'; } } } } if (Sentinel::isAuthSet()) { echo $return; ?> <br><div class="alert alert-info" role="alert"><?php _e('Authentication is currently enabled'); ?> </div><br><div class="row"><div class="col-xs-12"><div class="alert alert-danger"><?php _e('Please remove this file on your server to disable authentication'); ?>