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 EmailSender { get; set; }
|
||||||
public string EmailUsername { get; set; }
|
public string EmailUsername { get; set; }
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
public bool Authentication { get; set; }
|
||||||
public bool EnableUserEmailNotifications { get; set; }
|
public bool EnableUserEmailNotifications { get; set; }
|
||||||
public string RecipientEmail { get; set; }
|
public string RecipientEmail { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +1,45 @@
|
||||||
#region Copyright
|
#region Copyright
|
||||||
// /************************************************************************
|
// /************************************************************************
|
||||||
// Copyright (c) 2016 Jamie Rees
|
// Copyright (c) 2016 Jamie Rees
|
||||||
// File: SonarrValidator.cs
|
// File: SonarrValidator.cs
|
||||||
// Created By: Jamie Rees
|
// Created By: Jamie Rees
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
// a copy of this software and associated documentation files (the
|
// a copy of this software and associated documentation files (the
|
||||||
// "Software"), to deal in the Software without restriction, including
|
// "Software"), to deal in the Software without restriction, including
|
||||||
// without limitation the rights to use, copy, modify, merge, publish,
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
// permit persons to whom the Software is furnished to do so, subject to
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
// the following conditions:
|
// the following conditions:
|
||||||
//
|
//
|
||||||
// The above copyright notice and this permission notice shall be
|
// The above copyright notice and this permission notice shall be
|
||||||
// included in all copies or substantial portions of the Software.
|
// included in all copies or substantial portions of the Software.
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Validators
|
namespace PlexRequests.UI.Validators
|
||||||
{
|
{
|
||||||
public class EmailNotificationSettingsValidator : AbstractValidator<EmailNotificationSettings>
|
public class EmailNotificationSettingsValidator : AbstractValidator<EmailNotificationSettings>
|
||||||
{
|
{
|
||||||
public EmailNotificationSettingsValidator()
|
public EmailNotificationSettingsValidator()
|
||||||
{
|
{
|
||||||
RuleFor(request => request.EmailHost).NotEmpty().WithMessage("You must specify a Host name.");
|
RuleFor(request => request.EmailHost).NotEmpty().WithMessage("You must specify a Host name.");
|
||||||
RuleFor(request => request.EmailPort).NotEmpty().WithMessage("You must specify a Port.");
|
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).NotEmpty().WithMessage("You must specify a Recipient.");
|
||||||
RuleFor(request => request.RecipientEmail).EmailAddress().WithMessage("You must specify a valid 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.EmailSender).EmailAddress().WithMessage("You must specify a valid Email for the email sender.");
|
||||||
RuleFor(request => request.EmailPassword).NotEmpty().WithMessage("You must specify a valid password.");
|
RuleFor(request => request.EmailSender).NotEmpty().WithMessage("You must specify a Email Sender.");
|
||||||
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">
|
<form class="form-horizontal" method="POST" id="mainForm">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Email Notifications</legend>
|
<legend>Email Notifications</legend>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|
||||||
|
@ -33,21 +33,35 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|
||||||
@if (Model.EnableUserEmailNotifications)
|
@if (Model.EnableUserEmailNotifications)
|
||||||
{
|
{
|
||||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications" checked="checked"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications" checked="checked"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
|
||||||
</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">
|
<div class="form-group">
|
||||||
<label for="EmailHost" class="control-label">SMTP Host name or IP</label>
|
<label for="EmailHost" class="control-label">SMTP Host name or IP</label>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
@ -144,6 +158,15 @@
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
|
var auth = $('#Authentication').prop('checked');
|
||||||
|
ChangeUsernameAndPassword(auth);
|
||||||
|
|
||||||
|
|
||||||
|
$("#Authentication")
|
||||||
|
.change(function(e) {
|
||||||
|
ChangeUsernameAndPassword(auth);
|
||||||
|
});
|
||||||
|
|
||||||
var base = '@Html.GetBaseUrl()';
|
var base = '@Html.GetBaseUrl()';
|
||||||
$('#save').click(function (e) {
|
$('#save').click(function (e) {
|
||||||
e.preventDefault();
|
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