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; 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")] [Authorize(AuthenticationSchemes = "confirm", Roles = "Wizard")]
[Read("machine")] [Read("machine")]
public string GetMachineName() public string GetMachineName()

View File

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

View File

@ -5,11 +5,12 @@
public string Email { get; set; } public string Email { get; set; }
public string Pwd { get; set; } public string Pwd { get; set; }
public string Lng { get; set; } public string Lng { get; set; }
public string TimeZone { get; set; }
public string Promocode { get; set; } public string Promocode { get; set; }
public string AmiId { get; set; } public string AmiId { get; set; }
public bool Analytics { 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) 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, promocode, amiid, analytics) = (Email, Pwd, Lng, Promocode, AmiId, Analytics); => (email, pwd, lng, timeZone, promocode, amiid, analytics) = (Email, Pwd, Lng, TimeZone, Promocode, AmiId, Analytics);
} }
} }