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)
|
||||
{
|
||||
UserHelper.EnableUserEmail(config, email);
|
||||
UserHelper.EditUserEmailMaxSize(config, email, (int)emailPrice.Storage);
|
||||
UserHelper.EditUserEmailMaxSize(config, email, emailPrice.Storage);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -35,14 +35,14 @@ namespace Teknik.MailService
|
||||
_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 newAccount = domain.Accounts.Add();
|
||||
newAccount.Address = username;
|
||||
newAccount.Password = password;
|
||||
newAccount.Active = true;
|
||||
newAccount.MaxSize = size;
|
||||
newAccount.MaxSize = (int)(size / 1000000);
|
||||
|
||||
newAccount.Save();
|
||||
}
|
||||
@ -94,10 +94,10 @@ namespace Teknik.MailService
|
||||
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);
|
||||
account.MaxSize = size;
|
||||
account.MaxSize = (int)(size / 1000000);
|
||||
account.Save();
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,11 @@ namespace Teknik.MailService
|
||||
|
||||
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 EditMaxSize(string username, int size);
|
||||
void EditMaxSize(string username, long size);
|
||||
|
||||
void EditMaxEmailsPerDay(string username, int maxPerDay);
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace Teknik.Areas.Billing
|
||||
if (active)
|
||||
{
|
||||
UserHelper.EnableUserEmail(config, email);
|
||||
UserHelper.EditUserEmailMaxSize(config, email, (int)price.Storage);
|
||||
UserHelper.EditUserEmailMaxSize(config, email, price.Storage);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -34,6 +34,8 @@ namespace Teknik.Areas.Billing.Controllers
|
||||
[AllowAnonymous]
|
||||
public IActionResult ViewSubscriptions()
|
||||
{
|
||||
ViewBag.Title = "Subscriptions";
|
||||
|
||||
var subVM = new SubscriptionsViewModel();
|
||||
|
||||
// Get Biling Service
|
||||
|
@ -580,6 +580,10 @@ namespace Teknik.Areas.Users.Controllers
|
||||
model.Page = "Upload";
|
||||
model.UserID = user.UserId;
|
||||
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.ExpirationLength = user.UploadSettings.ExpirationLength;
|
||||
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
|
||||
{
|
||||
|
@ -10,6 +10,9 @@ namespace Teknik.Areas.Users.ViewModels
|
||||
{
|
||||
public class UploadSettingsViewModel : SettingsViewModel
|
||||
{
|
||||
public long MaxStorage { get; set; }
|
||||
public long MaxFileSize { get; set; }
|
||||
|
||||
public bool Encrypt { get; set; }
|
||||
public int ExpirationLength { get; set; }
|
||||
public ExpirationUnit ExpirationUnit { get; set; }
|
||||
|
@ -12,6 +12,22 @@
|
||||
|
||||
<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">
|
||||
|
||||
<div class="row form-horizontal">
|
||||
|
Loading…
Reference in New Issue
Block a user