settings.html.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <h2><?= T_("VPN Client Configuration") ?></h2>
  2. <?php if($faststatus): ?>
  3. <span class="label label-success" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Running') ?></span>
  4. <?php else: ?>
  5. <span class="label label-danger" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Not Running') ?></span>
  6. <?php endif; ?>
  7. &nbsp; <img src="public/img/loading.gif" id="status-loading" alt="Loading..." /><a href="#" id="statusbtn" data-toggle="tooltip" data-title="<?= T_('Loading complete status may take a few minutes. Be patient.') ?>"><?= T_('More details') ?></a>
  8. <div id="status" class="alert alert-dismissible alert-info fade in" style="margin-top: 10px" role="alert">
  9. <button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  10. <div id="status-text"></div>
  11. </div>
  12. <hr />
  13. <div class="row">
  14. <div class="col-sm-offset-2 col-sm-8">
  15. <form method="post" enctype="multipart/form-data" action="?/settings" class="form-horizontal" role="form" id="form">
  16. <input type="hidden" name="_method" value="put" />
  17. <div class="panel panel-default">
  18. <div class="panel-heading">
  19. <h3 class="panel-title"><?= T_("VPN") ?></h3>
  20. </div>
  21. <div style="padding: 14px 14px 0 10px">
  22. <div class="form-group">
  23. <label for="server_name" class="col-sm-3 control-label"><?= T_('Server Address') ?></label>
  24. <div class="col-sm-9">
  25. <input type="text" class="form-control" name="server_name" id="server_name" placeholder="access.ldn-fai.net" value="<?= $server_name ?>" />
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label for="server_port" class="col-sm-3 control-label"><?= T_('Server Port') ?></label>
  30. <div class="col-sm-9">
  31. <input type="text" data-toggle="tooltip" data-title="<?= T_('With restricted access, you should use 443 (TCP) or 53 (UDP)') ?>" class="form-control" name="server_port" id="server_port" placeholder="1194" value="<?= $server_port ?>" />
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label for="server_proto" class="col-sm-3 control-label"><?= T_('Protocol') ?></label>
  36. <div class="btn-group col-sm-9" data-toggle="buttons">
  37. <label class="btn btn-default <?= $server_proto == 'udp' ? 'active' : '' ?>">
  38. <input type="radio" name="server_proto" value="udp" <?= $server_proto == 'udp' ? 'checked="cheked"' : '' ?> /> <?= T_('UDP') ?>
  39. </label>
  40. <label class="btn btn-default <?= $server_proto == 'tcp' ? 'active' : '' ?>" data-toggle="tooltip" data-title="<?= T_('UDP is more efficient than TCP (but more filtered in case of restrictive access)') ?>">
  41. <input type="radio" name="server_proto" value="tcp" <?= $server_proto == 'tcp' ? 'checked="cheked"' : '' ?> /> <?= T_('TCP') ?>
  42. </label>
  43. </div>
  44. </div>
  45. <div class="form-group" id="raw_openvpn_btnpanel">
  46. <label class="col-sm-3 control-label"></label>
  47. <div class="col-sm-9">
  48. <span class="glyphicon glyphicon-cog"></span> <a href="#" id="raw_openvpn_btn" data-toggle="tooltip" data-title="<?= T_('Edit the raw configuration only if you know what you do!') ?>"><?= T_('Advanced') ?></a>
  49. </div>
  50. </div>
  51. <div class="form-group" id="raw_openvpn_panel">
  52. <label for="raw_openvpn" class="col-sm-3 control-label"><?= T_('Advanced') ?></label>
  53. <div class="col-sm-9">
  54. <pre><textarea class="form-control" name="raw_openvpn" id="raw_openvpn"><?= $raw_openvpn ?></textarea></pre>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="panel panel-default">
  60. <div class="panel-heading">
  61. <h3 class="panel-title"><?= T_("IPv6") ?></h3>
  62. </div>
  63. <div style="padding: 14px 14px 0 10px">
  64. <div class="form-group">
  65. <label for="ip6_net" class="col-sm-3 control-label"><?= T_('Delegated prefix') ?></label>
  66. <div class="col-sm-9">
  67. <input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if your Internet Service Provider does not give you a delegated prefix') ?>" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <?php if(!$crt_client_key_exists && empty($login_user)): ?>
  73. <div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 0px 17px" role="alert">
  74. <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  75. <strong><?= T_('Notice') ?>:</strong> <?= T_("You need to upload a Client Certificate, or define a Username (or both) for starting your VPN Client.") ?>
  76. </div>
  77. <?php endif; ?>
  78. <div class="panel panel-default">
  79. <div class="panel-heading">
  80. <h3 class="panel-title"><?= T_("Certificates") ?></h3>
  81. </div>
  82. <div style="padding: 14px 14px 0 10px">
  83. <div class="form-group">
  84. <label for="crt_client" class="col-sm-3 control-label"><?= $crt_client_exists ? T_('Update Client Cert.') : T_('Upload Client Cert.') ?></label>
  85. <div class="input-group col-sm-9" style="padding: 0 15px">
  86. <?php if($crt_client_exists): ?>
  87. <a class="btn btn-danger input-group-addon deletefile" id="crt_client_deletebtn" data-toggle="tooltip" data-title="<?= T_('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  88. <input id="crt_client_delete" name="crt_client_delete" type="checkbox" value="1" style="display: none" />
  89. <?php endif; ?>
  90. <input type="text" class="form-control fileinput" id="crt_client_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
  91. <input id="crt_client" name="crt_client" type="file" style="display: none" />
  92. <a class="btn input-group-addon fileinput" id="crt_client_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label for="crt_client_key" class="col-sm-3 control-label"><?= $crt_client_key_exists ? T_('Update Client Key') : T_('Upload Client Key') ?></label>
  97. <div class="input-group col-sm-9" style="padding: 0 15px">
  98. <?php if($crt_client_key_exists): ?>
  99. <a class="btn btn-danger input-group-addon deletefile" id="crt_client_key_deletebtn" data-toggle="tooltip" data-title="<?= T_('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  100. <input id="crt_client_key_delete" name="crt_client_key_delete" type="checkbox" value="1" style="display: none" />
  101. <?php endif; ?>
  102. <input type="text" class="form-control fileinput" id="crt_client_key_choosertxt" placeholder="-----BEGIN PRIVATE KEY-----" readonly="readonly" />
  103. <input id="crt_client_key" name="crt_client_key" type="file" style="display: none" />
  104. <a class="btn input-group-addon fileinput" id="crt_client_key_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. <?php if(!$crt_server_ca_exists): ?>
  109. <div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 16px 17px" role="alert">
  110. <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  111. <strong><?= T_('Notice') ?>:</strong> <?= T_("You need to upload a Server CA for starting your VPN Client.") ?>
  112. </div>
  113. <?php endif; ?>
  114. <label for="crt_server_ca" class="col-sm-3 control-label"><?= $crt_server_ca_exists ? T_('Update Server CA') : T_('Upload Server CA') ?></label>
  115. <div class="input-group col-sm-9" style="padding: 0 15px">
  116. <?php if($crt_server_ca_exists): ?>
  117. <a class="btn btn-danger not-allowed btn-disabled input-group-addon" id="crt_server_ca_deletebtn" data-toggle="tooltip" data-title="<?= T_('You cannot have no server CA') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  118. <input id="crt_server_ca_delete" name="crt_server_ca_delete" type="checkbox" value="1" style="display: none" />
  119. <?php endif; ?>
  120. <input type="text" class="form-control fileinput" id="crt_server_ca_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
  121. <input id="crt_server_ca" name="crt_server_ca" type="file" style="display: none" />
  122. <a class="btn input-group-addon fileinput" id="crt_server_ca_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="panel panel-default">
  128. <div class="panel-heading">
  129. <h3 class="panel-title"><?= T_("Login") ?></h3>
  130. </div>
  131. <div style="padding: 14px 14px 0 10px">
  132. <div class="form-group">
  133. <label for="login_user" class="col-sm-3 control-label"><?= T_('Username') ?></label>
  134. <div class="col-sm-9">
  135. <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 ?>" />
  136. </div>
  137. </div>
  138. <div class="form-group">
  139. <label for="login_passphrase" class="col-sm-3 control-label"><?= T_('Password') ?></label>
  140. <div class="col-sm-9">
  141. <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 ?>" />
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="form-group">
  147. <div style="text-align: center">
  148. <button type="submit" class="btn btn-default" data-toggle="tooltip" id="save" data-title="<?= T_('Reloading may take a few minutes. Be patient.') ?>"><?= T_('Save and reload') ?></button> <img src="public/img/loading.gif" id="save-loading" alt="Loading..." />
  149. </div>
  150. </div>
  151. </form>
  152. </div>
  153. </div>