Wizard: Complete. Timezone

This commit is contained in:
pavelbannov 2020-08-03 15:01:02 +03:00
parent a6b11e84c5
commit f6d71ad1f6
3 changed files with 12 additions and 14 deletions

View File

@ -575,16 +575,6 @@ namespace ASC.Api.Settings
return listOfTimezones;
}
[Authorize(AuthenticationSchemes = "confirm", Roles = "Wizard,Administrators")]
[Create("timezones")]
public TimezonesModel SaveTimeZone(TimezonesModel model)
{
Tenant.TimeZone = TimeZoneConverter.GetTimeZone(model.Id).Id;
TenantManager.SaveTenant(Tenant);
return model;
}
[Authorize(AuthenticationSchemes = "confirm", Roles = "Wizard")]
[Read("machine")]
public string GetMachineName()

View File

@ -72,6 +72,7 @@ namespace ASC.Web.Studio.UserControls.FirstTime
public MessageService MessageService { get; }
public LicenseReader LicenseReader { get; }
public StudioNotifyService StudioNotifyService { get; }
public TimeZoneConverter TimeZoneConverter { get; }
public FirstTimeTenantSettings(
IOptionsMonitor<ILog> options,
@ -88,7 +89,8 @@ namespace ASC.Web.Studio.UserControls.FirstTime
PaymentManager paymentManager,
MessageService messageService,
LicenseReader licenseReader,
StudioNotifyService studioNotifyService)
StudioNotifyService studioNotifyService,
TimeZoneConverter timeZoneConverter)
{
Log = options.CurrentValue;
Configuration = configuration;
@ -105,13 +107,14 @@ namespace ASC.Web.Studio.UserControls.FirstTime
MessageService = messageService;
LicenseReader = licenseReader;
StudioNotifyService = studioNotifyService;
TimeZoneConverter = timeZoneConverter;
}
public WizardSettings SaveData(WizardModel wizardModel)
{
try
{
var (email, pwd, lng, promocode, amiid, analytics) = wizardModel;
var (email, pwd, lng, timeZone, promocode, amiid, analytics) = wizardModel;
var tenant = TenantManager.GetCurrentTenant();
var settings = SettingsManager.Load<WizardSettings>();
@ -183,6 +186,10 @@ namespace ASC.Web.Studio.UserControls.FirstTime
TrySetLanguage(tenant, lng);
tenant.TimeZone = TimeZoneConverter.GetTimeZone(timeZone).Id;
TenantManager.SaveTenant(tenant);
StudioNotifyService.SendCongratulations(currentUser);
SendInstallInfo(currentUser);

View File

@ -5,11 +5,12 @@
public string Email { get; set; }
public string Pwd { get; set; }
public string Lng { get; set; }
public string TimeZone { get; set; }
public string Promocode { get; set; }
public string AmiId { get; set; }
public bool Analytics { get; set; }
public void Deconstruct(out string email, out string pwd, out string lng, out string promocode, out string amiid, out bool analytics)
=> (email, pwd, lng, promocode, amiid, analytics) = (Email, Pwd, Lng, Promocode, AmiId, Analytics);
public void Deconstruct(out string email, out string pwd, out string lng, out string timeZone, out string promocode, out string amiid, out bool analytics)
=> (email, pwd, lng, timeZone, promocode, amiid, analytics) = (Email, Pwd, Lng, TimeZone, Promocode, AmiId, Analytics);
}
}