mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Added an application URL in the customization settings #1513
This commit is contained in:
parent
5472baff24
commit
9556ed1b34
7 changed files with 44 additions and 9 deletions
|
@ -11,6 +11,7 @@ namespace Ombi.Notifications
|
|||
|
||||
public void Setup(FullBaseRequest req, CustomizationSettings s)
|
||||
{
|
||||
ApplicationUrl = s.ApplicationUrl;
|
||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||
? req.RequestedUser.UserName
|
||||
|
@ -25,6 +26,7 @@ namespace Ombi.Notifications
|
|||
|
||||
public void Setup(ChildRequests req, CustomizationSettings s)
|
||||
{
|
||||
ApplicationUrl = s.ApplicationUrl;
|
||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||
? req.RequestedUser.UserName
|
||||
|
@ -40,6 +42,7 @@ namespace Ombi.Notifications
|
|||
|
||||
public void Setup(OmbiUser user, CustomizationSettings s)
|
||||
{
|
||||
ApplicationUrl = s.ApplicationUrl;
|
||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||
RequestedUser = user.UserName;
|
||||
}
|
||||
|
@ -56,6 +59,7 @@ namespace Ombi.Notifications
|
|||
public string SeasonsList { get; set; }
|
||||
public string PosterImage { get; set; }
|
||||
public string ApplicationName { get; set; }
|
||||
public string ApplicationUrl { get; set; }
|
||||
|
||||
// System Defined
|
||||
private string LongDate => DateTime.Now.ToString("D");
|
||||
|
@ -80,6 +84,7 @@ namespace Ombi.Notifications
|
|||
{nameof(SeasonsList),SeasonsList},
|
||||
{nameof(PosterImage),PosterImage},
|
||||
{nameof(ApplicationName),ApplicationName},
|
||||
{nameof(ApplicationUrl),ApplicationUrl},
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,8 +1,29 @@
|
|||
namespace Ombi.Settings.Settings.Models
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ombi.Settings.Settings.Models
|
||||
{
|
||||
public class CustomizationSettings : Settings
|
||||
{
|
||||
public string ApplicationName { get; set; }
|
||||
public string ApplicationUrl { get; set; }
|
||||
|
||||
public void AddToUrl(string part)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ApplicationUrl))
|
||||
{
|
||||
ApplicationUrl = part;
|
||||
}
|
||||
|
||||
if (ApplicationUrl.EndsWith("/"))
|
||||
{
|
||||
ApplicationUrl.Remove(ApplicationUrl.Length - 1);
|
||||
}
|
||||
if (!part.StartsWith("/"))
|
||||
{
|
||||
part = "/" + part;
|
||||
}
|
||||
ApplicationUrl = ApplicationUrl + part;
|
||||
}
|
||||
public string Logo { get; set; }
|
||||
}
|
||||
}
|
|
@ -170,7 +170,7 @@ namespace Ombi.Store.Context
|
|||
notificationToAdd = new NotificationTemplates
|
||||
{
|
||||
NotificationType = notificationType,
|
||||
Message = "Hello! You have been invited to use {ApplicationName}!",
|
||||
Message = "Hello! You have been invited to use {ApplicationName}! You can login here: {ApplicationUrl}",
|
||||
Subject = "Invite to {ApplicationName}",
|
||||
Agent = agent,
|
||||
Enabled = true,
|
||||
|
|
|
@ -87,6 +87,7 @@ export interface ILandingPageSettings extends ISettings {
|
|||
|
||||
export interface ICustomizationSettings extends ISettings {
|
||||
applicationName: string;
|
||||
applicationUrl: string;
|
||||
logo: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="applicationurl" class="control-label">Application URL</label>
|
||||
<div>
|
||||
<input type="text" [(ngModel)]="settings.applicationurl" class="form-control form-control-custom " id="applicationurl" name="applicationurl" placeholder="http://ombi.io/" value="{{settings.applicationurl}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logo" class="control-label">Custom Logo</label>
|
||||
<div>
|
||||
|
|
|
@ -21,6 +21,7 @@ export class NotificationTemplate {
|
|||
{SeasonsList} : A comma seperated list of seasons requested<br/>
|
||||
{PosterImage} : The requested poster image link<br/>
|
||||
{ApplicationName} : The Application Name from the Customization Settings
|
||||
{ApplicationUrl} : The Application URL from the Customization Settings
|
||||
{LongDate} : 15 June 2017 <br/>
|
||||
{ShortDate} : 15/06/2017 <br/>
|
||||
{LongTime} : 16:02:34 <br/>
|
||||
|
|
|
@ -473,15 +473,15 @@ namespace Ombi.Controllers
|
|||
? "Ombi"
|
||||
: customizationSettings.ApplicationName);
|
||||
|
||||
customizationSettings.AddToUrl("/token?token=");
|
||||
var url = customizationSettings.ApplicationUrl;
|
||||
|
||||
var url =
|
||||
$"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}";
|
||||
await EmailProvider.SendAdHoc(new NotificationMessage
|
||||
{
|
||||
To = user.Email,
|
||||
Subject = $"{appName} Password Reset",
|
||||
Message = $"You recently made a request to reset your {appName} account. Please click the link below to complete the process.<br/><br/>" +
|
||||
$"<a href=\"{url}/token?token={token}\"> Reset </a>"
|
||||
$"<a href=\"{url}{token}\"> Reset </a>"
|
||||
}, emailSettings);
|
||||
|
||||
return defaultMessage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue