Add credentials option and switch delegated prefix to optional
This commit is contained in:
@@ -16,17 +16,36 @@ function restart_service() {
|
||||
}
|
||||
|
||||
dispatch('/', function() {
|
||||
$ip6_net = moulinette_get('ip6_net');
|
||||
$ip6_net = ($ip6_net == 'none') ? '' : $ip6_net;
|
||||
|
||||
set('server_name', moulinette_get('server_name'));
|
||||
set('server_port', moulinette_get('server_port'));
|
||||
set('server_proto', moulinette_get('server_proto'));
|
||||
set('login_user', moulinette_get('login_user'));
|
||||
set('login_passphrase', moulinette_get('login_passphrase'));
|
||||
set('ip6_net', $ip6_net);
|
||||
|
||||
return render('settings.html.php');
|
||||
});
|
||||
|
||||
dispatch_put('/settings', function() {
|
||||
$ip6_net = empty($_POST['ip6_net']) ? 'none' : $_POST['ip6_net'];
|
||||
|
||||
moulinette_set('server_name', $_POST['server_name']);
|
||||
moulinette_set('server_port', $_POST['server_port']);
|
||||
moulinette_set('server_proto', $_POST['server_proto']);
|
||||
moulinette_set('login_user', $_POST['login_user']);
|
||||
moulinette_set('login_passphrase', $_POST['login_passphrase']);
|
||||
moulinette_set('ip6_net', $ip6_net);
|
||||
|
||||
# TODO: format ip6_net
|
||||
if($ip6_net == 'none') {
|
||||
moulinette_set('ip6_addr', 'none');
|
||||
} else {
|
||||
$ip6_addr = "${ip6_net}1";
|
||||
moulinette_set('ip6_addr', $ip6_addr);
|
||||
}
|
||||
|
||||
if($_FILES['crt_client']['error'] == UPLOAD_ERR_OK) {
|
||||
move_uploaded_file($_FILES['crt_client']['tmp_name'], '/etc/openvpn/keys/user.crt');
|
||||
|
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="server_port" class="col-sm-3 control-label"><?= T_('Protocol') ?></label>
|
||||
<label for="server_proto" class="col-sm-3 control-label"><?= T_('Protocol') ?></label>
|
||||
<div class="btn-group col-sm-9" data-toggle="buttons">
|
||||
<label class="btn btn-default <?= $server_proto == 'udp' ? 'active' : '' ?>">
|
||||
<input type="radio" name="server_proto" value="udp" <?= $server_proto == 'udp' ? 'checked="cheked"' : '' ?> /> <?= T_('UDP') ?>
|
||||
@@ -42,6 +42,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title" data-toggle="tooltip" data-title="<?= T_('Real Internet') ?>"><?= T_("IPv6") ?></h3>
|
||||
</div>
|
||||
|
||||
<div style="padding: 14px 14px 0 10px">
|
||||
<div class="form-group">
|
||||
<label for="ip6_net" class="col-sm-3 control-label"><?= T_('Delegated prefix') ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if your internet provider is a dirty provider that does not give you a delegated prefix') ?>" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= T_("Certificates") ?></h3>
|
||||
@@ -77,6 +92,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= T_("Login") ?></h3>
|
||||
</div>
|
||||
|
||||
<div style="padding: 14px 14px 0 10px">
|
||||
<div class="form-group">
|
||||
<label for="login_user" class="col-sm-3 control-label"><?= T_('Username') ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if not necessary') ?>" class="form-control" name="login_user" id="login_user" placeholder="michu" value="<?= $login_user ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="login_passphrase" class="col-sm-3 control-label"><?= T_('Password') ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if not necessary') ?>" class="form-control" name="login_passphrase" id="login_passphrase" placeholder="XVCwSbDkxnqQ" value="<?= $login_passphrase ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div style="text-align: center">
|
||||
<button type="submit" class="btn btn-default" data-toggle="tooltip" data-title="<?= T_('Reloading may take a few minutes. Be patient.') ?>"><?= T_('Save and reload') ?></button>
|
||||
|
Reference in New Issue
Block a user