github.com/Ne0nd0g/gophish@v0.7.1-0.20190220040016-11493024a07d/static/js/src/app/settings.js (about)

     1  $(document).ready(function () {
     2      $("#apiResetForm").submit(function (e) {
     3          api.reset()
     4              .success(function (response) {
     5                  user.api_key = response.data
     6                  successFlash(response.message)
     7                  $("#api_key").val(user.api_key)
     8              })
     9              .error(function (data) {
    10                  errorFlash(data.message)
    11              })
    12          return false
    13      })
    14      $("#settingsForm").submit(function (e) {
    15          $.post("/settings", $(this).serialize())
    16              .done(function (data) {
    17                  successFlash(data.message)
    18              })
    19              .fail(function (data) {
    20                  errorFlash(data.responseJSON.message)
    21              })
    22          return false
    23      })
    24      var use_map = localStorage.getItem('gophish.use_map')
    25      $("#use_map").prop('checked', JSON.parse(use_map))
    26      $("#use_map").on('change', function () {
    27          localStorage.setItem('gophish.use_map', JSON.stringify(this.checked))
    28      })
    29  })