Skip to content

Commit 047ea06

Browse files
committed
Improvements to login page
1 parent a9d373d commit 047ea06

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/UniGetUI/Services/GitHubAuthService.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@ public class GitHubAuthService
1414
private readonly string GitHubClientId = Secrets.GetGitHubClientId();
1515
private readonly string GitHubClientSecret = Secrets.GetGitHubClientSecret();
1616

17+
private const string DataReceivedWebsite = """
18+
<html>
19+
<style>
20+
div {
21+
display: flex;
22+
flex-direction: column;
23+
align-items: center;
24+
justify-content: center;
25+
height: 100vh;
26+
font-family: sans-serif;
27+
text-align: center;
28+
}
29+
</style>
30+
<script>
31+
window.close();
32+
</script>
33+
<div>
34+
<title>UniGetUI authentication</title>
35+
<h1>Authentication successful</h1>
36+
<p>You can now close this window and return to UniGetUI</p>
37+
</div>
38+
</html>
39+
""";
40+
1741
private const string RedirectUri = "http://127.0.0.1:58642/";
1842

1943
private readonly GitHubClient _client;
@@ -65,8 +89,7 @@ public async Task<bool> SignInAsync()
6589
var context = await httpListener.GetContextAsync();
6690

6791
var response = context.Response;
68-
string responseString = "<html><head><title>Auth Success</title></head><body><h1>Authentication successful!</h1><p>You can now close this window and return to the UniGetUI application.</p></body></html>";
69-
var buffer = Encoding.UTF8.GetBytes(responseString);
92+
var buffer = Encoding.UTF8.GetBytes(DataReceivedWebsite);
7093
response.ContentLength64 = buffer.Length;
7194
var output = response.OutputStream;
7295
await output.WriteAsync(buffer, 0, buffer.Length);

0 commit comments

Comments
 (0)