Small improvements to the wizard

pull/470/head
tidusjar 8 years ago
parent 963b4e6ee8
commit d6c2956ee7

@ -176,6 +176,14 @@ namespace PlexRequests.Core
Log.Error(ex, "Failed to cache CouchPotato quality profiles!");
}
}
/// <summary>
/// Migrates to version 1.9.
/// Move the Plex auth token to the new field.
/// Reconfigure the log level
/// Set the wizard flag to true if we already have settings
/// </summary>
public void MigrateToVersion1900()
{
// Need to change the Plex Token location
@ -183,58 +191,33 @@ namespace PlexRequests.Core
var auth = authSettings.GetSettings();
var plexSettings = new SettingsServiceV2<PlexSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
var currentSettings = plexSettings.GetSettings();
if (!string.IsNullOrEmpty(auth?.OldPlexAuthToken))
{
currentSettings.PlexAuthToken = auth?.OldPlexAuthToken;
plexSettings.SaveSettings(currentSettings);
// Clear out the old value
auth.OldPlexAuthToken = string.Empty;
authSettings.SaveSettings(auth);
}
//If we have an authToken we do not need to go through the setup
if (!string.IsNullOrEmpty(auth?.OldPlexAuthToken))
if (auth != null)
{
var prServuce = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
var settings = prServuce.GetSettings();
settings.Wizard = true;
prServuce.SaveSettings(settings);
}
}
/// <summary>
/// Migrates to version 1.8.
/// <para>This includes updating the admin account to have all roles.</para>
/// <para>Set the log level to Error</para>
/// <para>Enable Analytics by default</para>
/// </summary>
private void MigrateToVersion1800()
{
// Give admin all roles/claims
try
{
var userMapper = new UserMapper(new UserRepository<UsersModel>(Db, new MemoryCacheProvider()));
var users = userMapper.GetUsers();
//If we have an authToken we do not need to go through the setup
if (!string.IsNullOrEmpty(auth.OldPlexAuthToken))
{
var prServuce = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
var settings = prServuce.GetSettings();
settings.Wizard = true;
prServuce.SaveSettings(settings);
}
foreach (var u in users)
// Clear out the old token and save it to the new field
var currentSettings = plexSettings.GetSettings();
if (!string.IsNullOrEmpty(auth.OldPlexAuthToken))
{
var claims = new[] { UserClaims.User, UserClaims.Admin, UserClaims.PowerUser };
u.Claims = ByteConverterHelper.ReturnBytes(claims);
currentSettings.PlexAuthToken = auth.OldPlexAuthToken;
plexSettings.SaveSettings(currentSettings);
userMapper.EditUser(u);
// Clear out the old value
auth.OldPlexAuthToken = string.Empty;
authSettings.SaveSettings(auth);
}
}
catch (Exception e)
{
Log.Error(e);
}
// Set log level
// Set the log level
try
{
var settingsService = new SettingsServiceV2<LogSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
@ -243,7 +226,6 @@ namespace PlexRequests.Core
settingsService.SaveSettings(logSettings);
LoggingHelper.ReconfigureLogLevel(LogLevel.FromOrdinal(logSettings.Level));
}
catch (Exception e)
{
@ -265,7 +247,6 @@ namespace PlexRequests.Core
{
Log.Error(e);
}
}
}
}

@ -336,3 +336,8 @@ label {
.tooltip_templates {
display: none; }
.shadow {
-moz-box-shadow: 3px 3px 5px 6px #191919;
-webkit-box-shadow: 3px 3px 5px 6px #191919;
box-shadow: 3px 3px 5px 6px #191919; }

File diff suppressed because one or more lines are too long

@ -416,8 +416,17 @@ $border-radius: 10px;
font-weight: bold;
}
.checkbox-custom{
margin-top:0 $i;
margin-bottom:0 $i;
.checkbox-custom {
margin-top: 0 $i;
margin-bottom: 0 $i;
}
.tooltip_templates {
display: none;
}
.shadow {
-moz-box-shadow: 3px 3px 5px 6px #191919;
-webkit-box-shadow: 3px 3px 5px 6px #191919;
box-shadow: 3px 3px 5px 6px #191919;
}
.tooltip_templates { display: none; }

@ -12,7 +12,7 @@
@Html.LoadWizardAssets()
<img class="landing-header" src="@formAction/Content/images/logo.png" width="300" />
<div id="area" class="landing-block">
<div id="area" class="landing-block shadow">
<div class="media">
@ -30,6 +30,7 @@
</div>
<!--Templates-->
<script id="plexAuthArea" type="text/html">
<form method="post" action="/wizard/plexAuth" id="plexAuthForm">
@ -153,6 +154,8 @@
<script id="adminArea" type="text/html">
<form method="post" action="/wizard/createuser" id="adminForm">
<h4 class="media-heading landing-title">Create the Admin account</h4>
<small>This account will be used to configure your settings and also manage all of the requests.</small>
<div class="form-group">
<div>
<label for="adminUsername">Username</label><input type="text" class="form-control form-control-custom" id="adminUsername" name="Username" placeholder="Username">

Loading…
Cancel
Save