Skip to content

Commit

Permalink
Add "Create & Setup" button to the create tenant view (#16665)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Sep 4, 2024
1 parent fc4c439 commit 3b3b7f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public async Task<IActionResult> Create()
}

[HttpPost]
public async Task<IActionResult> Create(EditTenantViewModel model)
public async Task<IActionResult> Create(EditTenantViewModel model, string action)
{
if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenants))
{
Expand Down Expand Up @@ -380,6 +380,20 @@ public async Task<IActionResult> Create(EditTenantViewModel model)

await _shellHost.UpdateShellSettingsAsync(shellSettings);

if (action == "createAndSetup")
{
var dataProtector = _dataProtectorProvider.CreateProtector("Tokens").ToTimeLimitedDataProtector();

var entry = new ShellSettingsEntry
{
Name = shellSettings.Name,
ShellSettings = shellSettings,
Token = dataProtector.Protect(shellSettings["Secret"], _clock.UtcNow.Add(new TimeSpan(24, 0, 0)))
};

return Redirect(HttpContext.GetEncodedUrl(entry));
}

return RedirectToAction(nameof(Index));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<partial name="_TenantFeatureProfile" model="Model" />

<div class="mb-3">
<button class="btn btn-primary create" type="submit">@T["Create"]</button>
<button class="btn btn-primary create" type="submit" name="action" value="create">@T["Create"]</button>
<button class="btn btn-primary" type="submit" name="action" value="createAndSetup">@T["Create & Setup"]</button>
<a class="btn btn-secondary cancel" role="button" asp-route-action="Index">@T["Cancel"]</a>
</div>
</form>
Expand Down

0 comments on commit 3b3b7f2

Please sign in to comment.