Device Auth. Grant - the web browser part

This commit is contained in:
Dusan Jakub
2023-09-18 13:02:26 +02:00
parent 47cc55d87f
commit 6de8c49b12
12 changed files with 385 additions and 51 deletions

View File

@@ -74,7 +74,7 @@
<p>You are authorizing to <strong>{client.description}</strong>, which requests the following permissions from you:</p>
<form action="" method="post">
<form action="/auth/consent" method="post">
<input type="hidden" name="sessionId" value="{sessionId}">
<ul>
{#each scopes}

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.login-container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-container h2 {
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
font-weight: bold;
display: block;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.login-button {
width: 100%;
background-color: #007BFF;
color: #fff;
border: none;
padding: 10px;
border-radius: 5px;
cursor: pointer;
}
.login-button:hover {
background-color: #0056b3;
}
.error-popup {
background-color: #ff6b6b;
color: #fff;
padding: 10px;
text-align: center;
border-radius: 5px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
{#if error == "invalid_code"}
<div class="error-popup" id="error-popup">Invalid code</div>
{/if}
<form action="" method="post">
<div class="form-group">
<label for="code">User code:</label>
<input type="text" id="code" name="code" required>
</div>
<button type="submit" class="login-button">Login</button>
</form>
</div>
</body>
</html>

View File

@@ -73,7 +73,7 @@
{#if error == "invalid_credentials"}
<div class="error-popup" id="error-popup">Invalid credentials</div>
{/if}
<form action="" method="post">
<form action="/auth" method="post">
<input type="hidden" name="sessionId" value="{sessionId}">
<div class="form-group">
<label for="username">Username:</label>

View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.login-container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-container h2 {
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
font-weight: bold;
display: block;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.login-button {
width: 100%;
background-color: #007BFF;
color: #fff;
border: none;
padding: 10px;
border-radius: 5px;
cursor: pointer;
}
.login-button:hover {
background-color: #0056b3;
}
.error-popup {
background-color: #ff6b6b;
color: #fff;
padding: 10px;
text-align: center;
border-radius: 5px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Successful login</h2>
<p>You may close this window</p>
</div>
</body>
</html>