mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 18:16:55 -07:00
Should fix #429
This commit is contained in:
parent
67df79bcca
commit
ce7305faf0
3 changed files with 92 additions and 59 deletions
|
@ -34,6 +34,7 @@ namespace PlexRequests.Core.SettingModels
|
|||
public string EmailSender { get; set; }
|
||||
public string EmailUsername { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool Authentication { get; set; }
|
||||
public bool EnableUserEmailNotifications { get; set; }
|
||||
public string RecipientEmail { get; set; }
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ namespace PlexRequests.UI.Validators
|
|||
RuleFor(request => request.EmailPort).NotEmpty().WithMessage("You must specify a Port.");
|
||||
RuleFor(request => request.RecipientEmail).NotEmpty().WithMessage("You must specify a Recipient.");
|
||||
RuleFor(request => request.RecipientEmail).EmailAddress().WithMessage("You must specify a valid Recipient.");
|
||||
RuleFor(request => request.EmailUsername).NotEmpty().WithMessage("You must specify a Username.");
|
||||
RuleFor(request => request.EmailPassword).NotEmpty().WithMessage("You must specify a valid password.");
|
||||
RuleFor(request => request.EmailSender).EmailAddress().WithMessage("You must specify a valid Email for the email sender.");
|
||||
RuleFor(request => request.EmailSender).NotEmpty().WithMessage("You must specify a Email Sender.");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Email Notifications</legend>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
|
@ -33,21 +33,35 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.EnableUserEmailNotifications)
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications" checked="checked"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
@if (Model.EnableUserEmailNotifications)
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications" checked="checked"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<small>Please note that if user notifications is enabled, the email will get sent with the SMTP set-up below.</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.Authentication)
|
||||
{
|
||||
<input type="checkbox" id="Authentication" name="Authentication" checked="checked"><label for="Authentication">Enable SMTP Authentication</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Authentication" name="Authentication"><label for="Authentication">Enable SMTP Authentication</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<small>Please note that if user notifications is enabled, the email will get sent with the SMTP set-up below.</small>
|
||||
<div class="form-group">
|
||||
<label for="EmailHost" class="control-label">SMTP Host name or IP</label>
|
||||
<div class="">
|
||||
|
@ -144,6 +158,15 @@
|
|||
<script>
|
||||
$(function () {
|
||||
|
||||
var auth = $('#Authentication').prop('checked');
|
||||
ChangeUsernameAndPassword(auth);
|
||||
|
||||
|
||||
$("#Authentication")
|
||||
.change(function(e) {
|
||||
ChangeUsernameAndPassword(auth);
|
||||
});
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
$('#save').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
@ -207,6 +230,17 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
function ChangeUsernameAndPassword(checked) {
|
||||
var $userName = $('#EmailUsername');
|
||||
var $password = $('#EmailPassword');
|
||||
if (!checked) {
|
||||
$userName.attr('disabled', 'disabled');
|
||||
$password.attr('disabled', 'disabled');
|
||||
} else {
|
||||
$userName.removeAttr('disabled', 'disabled');
|
||||
$password.removeAttr('disabled', 'disabled');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue