Skip to content

Commit d52fbf9

Browse files
committed
display information about current linking status in account maintenance
1 parent 81fa225 commit d52fbf9

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Zero-K.info/Controllers/HomeController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public async Task<ActionResult> DiscordAuth(string code, string state)
249249
{
250250
MessageBox.Show("An error occured while linking the Discord account.");
251251
}
252-
return View("HomeIndex");
252+
return Index();
253253
}
254254

255255
[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)]
@@ -336,8 +336,8 @@ private ActionResult ProcessSteamOpenIDResponse(IAuthenticationResponse response
336336
case AuthenticationStatus.Failed:
337337
return Content("Login failed");
338338
}
339-
return View("HomeIndex");
340-
}
339+
return RedirectToAction("Index", "Home");
340+
}
341341

342342
public ActionResult Logout(string referer)
343343
{

Zero-K.info/Views/Shared/UserDetail.cshtml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,14 @@
392392
<h3 class="js_expand">Account maintenance</h3>
393393
<div id="accountMaint" class="collapse width-90">
394394
<h4>Link Discord Account</h4>
395+
@if (Global.Account.DiscordID.HasValue)
396+
{
397+
<div>
398+
Your account is currently linked to Discord ID @(Global.Account.DiscordID).
399+
</div><br />
400+
}
395401
<a href="@Global.Server.DiscordWebApi.GetAuthenticationURL(Global.AccountID)">Login with Discord</a> <br/>
396-
<br />
402+
397403
<h4>Change password</h4>
398404
@if (!string.IsNullOrEmpty(Model.PasswordBcrypt))
399405
{
@@ -422,6 +428,7 @@
422428
}
423429
@if (Global.IsModerator && Global.AccountID == Model.AccountID)
424430
{
431+
<br />
425432
<div class="admin">
426433
<h3>Admin extras</h3>
427434
<form action="@Url.Action("SetZklsMaxPlayers", "Admin")" method="post">

ZkLobbyServer/DiscordWebApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public async Task<bool> LinkAccount(string state, string code)
5252
if (!userIds.TryGetValue(state, out accountId))
5353
{
5454
Trace.TraceWarning("Invalid state " + state);
55-
return;
55+
return false;
5656
}
5757

5858
var request = new HttpRequestMessage(HttpMethod.Post, "https://discordapp.com/api/oauth2/token");

0 commit comments

Comments
 (0)