66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using System.Configuration;
|
|
using System.Web;
|
|
using LeafWeb.Core.Entities;
|
|
using LeafWeb.WebCms.Controllers;
|
|
using Umbraco.Core.Models;
|
|
|
|
namespace LeafWeb.WebCms.Services
|
|
{
|
|
public class UrlService
|
|
{
|
|
private readonly string _downloadUrl;
|
|
private readonly string _chartUrl;
|
|
private readonly string _verifyEmailUrl;
|
|
private readonly string _passwordResetUrl;
|
|
private readonly string _registerUrl;
|
|
|
|
public UrlService()
|
|
{
|
|
_downloadUrl =
|
|
ConfigurationManager.AppSettings["LeafWebUrl"]
|
|
+ ConfigurationManager.AppSettings["ResultsDownloadPath"];
|
|
|
|
_chartUrl =
|
|
ConfigurationManager.AppSettings["LeafWebUrl"]
|
|
+ ConfigurationManager.AppSettings["ChartPath"];
|
|
|
|
_verifyEmailUrl =
|
|
ConfigurationManager.AppSettings["LeafWebUrl"]
|
|
+ ConfigurationManager.AppSettings["MemberVerifyPath"];
|
|
|
|
_passwordResetUrl =
|
|
ConfigurationManager.AppSettings["LeafWebUrl"]
|
|
+ ConfigurationManager.AppSettings["PasswordResetPath"];
|
|
|
|
_registerUrl =
|
|
ConfigurationManager.AppSettings["LeafWebUrl"]
|
|
+ ConfigurationManager.AppSettings["RegisterPath"];
|
|
}
|
|
|
|
public string GetDownloadUrl(LeafInput leafInput)
|
|
{
|
|
return string.Format(_downloadUrl, leafInput.UniqueToken);
|
|
}
|
|
|
|
public string GetChartUrl(LeafInput leafInput)
|
|
{
|
|
return string.Format(_chartUrl, leafInput.UniqueToken);
|
|
}
|
|
|
|
public string GetVerifyEmailUrl(IMember member)
|
|
{
|
|
var memberEmail = member.Email;
|
|
var token = member.GetValue<string>(LeafWebMemberProperties.VerificationToken);
|
|
return string.Format(_verifyEmailUrl, HttpUtility.UrlEncode(memberEmail), token);
|
|
}
|
|
|
|
public string GetPasswordResetUrl(IMember member)
|
|
{
|
|
var memberEmail = member.Email;
|
|
var token = member.GetValue<string>(LeafWebMemberProperties.PasswordResetToken);
|
|
return string.Format(_passwordResetUrl, HttpUtility.UrlEncode(memberEmail), token);
|
|
}
|
|
|
|
public string GetRegisterUrl() => _registerUrl;
|
|
}
|
|
} |