<div id="UserWarnings">
  <div class="alert alert-secondary" data-ng-show="resources.notification.smtp_server === 'mail.globaleaks.org'">
    <i class="fa-solid fa-exclamation-circle"></i>
    <span data-translate>Default mail configuration in use. Please consider using a private mail server.</span>
  </div>
<div class="row">
  <div class="col-md-12">
    <div class="form-group">
      <label data-translate>SMTP email address</label>
      <input class="form-control" name="source_email" data-ng-model="resources.notification.smtp_source_email" data-ng-pattern="CONSTANTS.email_regexp" type="text" />
    </div>
    <div class="text-danger" data-ng-show="notificationForm.source_email.$error.pattern">
      <span data-translate>Invalid email address</span>
    </div>

    <div class="form-group">
      <label data-translate>SMTP server address</label>
      <input class="form-control" data-ng-model="resources.notification.smtp_server" type="text" />
    </div>

    <div class="form-group">
      <label data-translate>SMTP server port</label>
      <input class="form-control" data-ng-model="resources.notification.smtp_port" type="number" />
    </div>

    <div class="form-group">
      <label data-translate>Security</label>
      <select class="form-control" data-ng-model="resources.notification.smtp_security">
        <option value="PLAIN">PLAIN</option>
        <option value="SSL">SMTPS</option>
        <option value="TLS">SMTP/TLS</option>
      </select>
    </div>

    <div class="form-group">
      <input data-ng-model="resources.notification.smtp_authentication" type="checkbox">
      <label data-translate>Require authentication</label>
    </div>

    <div data-ng-show="resources.notification.smtp_authentication">
      <div class="form-group">
        <label data-translate>Username</label>
        <input class="form-control" data-ng-model="resources.notification.smtp_username" type="text" />
      </div>
      <div class="form-group">
        <label data-translate>Password</label>
        <input class="form-control" data-ng-model="resources.notification.smtp_password" type="password" placeholder="*****************" />
      </div>
    </div>
    <div class="form-group">
      <input data-ng-model="resources.notification.disable_admin_notification_emails" type="checkbox">
      <label data-translate>Disable notifications to administrators</label>
    </div>

    <div class="form-group">
      <input data-ng-model="resources.notification.disable_receiver_notification_emails" type="checkbox">
      <label data-translate>Disable notifications to recipients</label>
      <div data-ng-show="resources.notification.disable_receiver_notification_emails">
        <span class="badge badge-danger" data-translate>Disabled</span>
      </div>
    </div>

    <div class="form-group" data-ng-if="resources.node.enable_custodian">
      <input data-ng-model="resources.notification.disable_custodian_notification_emails" type="checkbox">
      <label data-translate>Disable notifications to custodians</label>
      <div data-ng-show="resources.notification.disable_custodian_notification_emails">
        <span class="badge badge-danger" data-translate>Disabled</span>
      </div>
    </div>

    <div class="form-group">
      <label data-translate>Number of hours before sending a report expiration alert</label>
      <input class="form-control" data-ng-model="resources.notification.tip_expiration_threshold" type="number" />
    </div>

    <div class="form-group">
      <button class="btn btn-primary" data-ng-disabled="notificationForm.$invalid" data-ng-click="Utils.update(resources.notification)" type="submit">
        <i class="fa-solid fa-check"></i>
        <span data-translate>Save</span>
      </button>
      <button data-uib-tooltip="{{'Send a test email to your email address.' | translate}}"
              data-ng-click="updateThenTestMail()"
              class="btn btn-primary">
        <i class="fa-solid fa-envelope"></i>
        <span data-translate>Test the configuration</span>
      </button>
      <button data-ng-click="Utils.runAdminOperation('reset_smtp_settings', {}, true)"
              class="btn btn-primary">
        <span data-translate>Reset SMTP configuration</span>
      </button>
      <button data-ng-click="Utils.runAdminOperation('reset_templates', {}, true)"
              class="btn btn-primary">
        <span data-translate>Reset notification templates to default</span>
      </button>
    </div>
  </div>
</div>
