mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
- Updated mail storage to be by bytes.
- Added upload limits to multiple spots
This commit is contained in:
parent
162a8c5e4e
commit
7f1efd40d5
@ -94,7 +94,7 @@ namespace Teknik.BillingService
|
|||||||
if (emailPrice != null)
|
if (emailPrice != null)
|
||||||
{
|
{
|
||||||
UserHelper.EnableUserEmail(config, email);
|
UserHelper.EnableUserEmail(config, email);
|
||||||
UserHelper.EditUserEmailMaxSize(config, email, (int)emailPrice.Storage);
|
UserHelper.EditUserEmailMaxSize(config, email, emailPrice.Storage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -35,14 +35,14 @@ namespace Teknik.MailService
|
|||||||
_App = InitApp();
|
_App = InitApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateAccount(string username, string password, int size)
|
public void CreateAccount(string username, string password, long size)
|
||||||
{
|
{
|
||||||
var domain = _App.Domains.ItemByName[_Domain];
|
var domain = _App.Domains.ItemByName[_Domain];
|
||||||
var newAccount = domain.Accounts.Add();
|
var newAccount = domain.Accounts.Add();
|
||||||
newAccount.Address = username;
|
newAccount.Address = username;
|
||||||
newAccount.Password = password;
|
newAccount.Password = password;
|
||||||
newAccount.Active = true;
|
newAccount.Active = true;
|
||||||
newAccount.MaxSize = size;
|
newAccount.MaxSize = (int)(size / 1000000);
|
||||||
|
|
||||||
newAccount.Save();
|
newAccount.Save();
|
||||||
}
|
}
|
||||||
@ -94,10 +94,10 @@ namespace Teknik.MailService
|
|||||||
mySQL.Execute(sql, new object[] { maxPerDay, username });
|
mySQL.Execute(sql, new object[] { maxPerDay, username });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditMaxSize(string username, int size)
|
public void EditMaxSize(string username, long size)
|
||||||
{
|
{
|
||||||
var account = GetAccount(username);
|
var account = GetAccount(username);
|
||||||
account.MaxSize = size;
|
account.MaxSize = (int)(size / 1000000);
|
||||||
account.Save();
|
account.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ namespace Teknik.MailService
|
|||||||
|
|
||||||
bool Enabled(string username);
|
bool Enabled(string username);
|
||||||
|
|
||||||
void CreateAccount(string username, string password, int size);
|
void CreateAccount(string username, string password, long size);
|
||||||
|
|
||||||
void EditPassword(string username, string password);
|
void EditPassword(string username, string password);
|
||||||
|
|
||||||
void EditMaxSize(string username, int size);
|
void EditMaxSize(string username, long size);
|
||||||
|
|
||||||
void EditMaxEmailsPerDay(string username, int maxPerDay);
|
void EditMaxEmailsPerDay(string username, int maxPerDay);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace Teknik.Areas.Billing
|
|||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
UserHelper.EnableUserEmail(config, email);
|
UserHelper.EnableUserEmail(config, email);
|
||||||
UserHelper.EditUserEmailMaxSize(config, email, (int)price.Storage);
|
UserHelper.EditUserEmailMaxSize(config, email, price.Storage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,8 @@ namespace Teknik.Areas.Billing.Controllers
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult ViewSubscriptions()
|
public IActionResult ViewSubscriptions()
|
||||||
{
|
{
|
||||||
|
ViewBag.Title = "Subscriptions";
|
||||||
|
|
||||||
var subVM = new SubscriptionsViewModel();
|
var subVM = new SubscriptionsViewModel();
|
||||||
|
|
||||||
// Get Biling Service
|
// Get Biling Service
|
||||||
|
@ -580,6 +580,10 @@ namespace Teknik.Areas.Users.Controllers
|
|||||||
model.Page = "Upload";
|
model.Page = "Upload";
|
||||||
model.UserID = user.UserId;
|
model.UserID = user.UserId;
|
||||||
model.Username = user.Username;
|
model.Username = user.Username;
|
||||||
|
|
||||||
|
model.MaxStorage = user.UploadSettings.MaxUploadStorage ?? _config.UploadConfig.MaxStorage;
|
||||||
|
model.MaxFileSize = user.UploadSettings.MaxUploadFileSize ?? _config.UploadConfig.MaxUploadFileSize;
|
||||||
|
|
||||||
model.Encrypt = user.UploadSettings.Encrypt;
|
model.Encrypt = user.UploadSettings.Encrypt;
|
||||||
model.ExpirationLength = user.UploadSettings.ExpirationLength;
|
model.ExpirationLength = user.UploadSettings.ExpirationLength;
|
||||||
model.ExpirationUnit = user.UploadSettings.ExpirationUnit;
|
model.ExpirationUnit = user.UploadSettings.ExpirationUnit;
|
||||||
|
@ -751,7 +751,7 @@ If you recieved this email and you did not reset your password, you can ignore t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EditUserEmailMaxSize(Config config, string email, int size)
|
public static void EditUserEmailMaxSize(Config config, string email, long size)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,9 @@ namespace Teknik.Areas.Users.ViewModels
|
|||||||
{
|
{
|
||||||
public class UploadSettingsViewModel : SettingsViewModel
|
public class UploadSettingsViewModel : SettingsViewModel
|
||||||
{
|
{
|
||||||
|
public long MaxStorage { get; set; }
|
||||||
|
public long MaxFileSize { get; set; }
|
||||||
|
|
||||||
public bool Encrypt { get; set; }
|
public bool Encrypt { get; set; }
|
||||||
public int ExpirationLength { get; set; }
|
public int ExpirationLength { get; set; }
|
||||||
public ExpirationUnit ExpirationUnit { get; set; }
|
public ExpirationUnit ExpirationUnit { get; set; }
|
||||||
|
@ -12,6 +12,22 @@
|
|||||||
|
|
||||||
<bundle src="css/user.settings.upload.min.css" append-version="true"></bundle>
|
<bundle src="css/user.settings.upload.min.css" append-version="true"></bundle>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h3 class="text-center">Upload Limits</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2 col-sm-offset-1"><strong>Storage</strong></div>
|
||||||
|
<div class="col-md-9"><strong>@StringHelper.GetBytesReadable(Model.MaxStorage)</strong></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2 col-sm-offset-1"><strong>File Size</strong></div>
|
||||||
|
<div class="col-md-9"><strong>@StringHelper.GetBytesReadable(Model.MaxFileSize)</strong></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<hr />
|
||||||
|
|
||||||
<!form class="form" action="##" method="post" id="updateForm">
|
<!form class="form" action="##" method="post" id="updateForm">
|
||||||
|
|
||||||
<div class="row form-horizontal">
|
<div class="row form-horizontal">
|
||||||
|
Loading…
Reference in New Issue
Block a user