Files
coder/site/static/oauth2allow.html
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

209 lines
5.8 KiB
HTML
Raw Normal View History

2024-02-20 15:58:43 -08:00
{{/* This template is used by application handlers to render allowing oauth2
links */}}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Application {{.AppName}}</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
background-color: #05060b;
color: #f7f9fd;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
font-size: 16px;
/* A fixed height would let align-items: center push a long scope list
past both edges, leaving the top half unreachable by scrolling. */
min-height: 100%;
2024-02-20 15:58:43 -08:00
}
.container {
--side-padding: 24px;
width: 100%;
max-width: calc(320px + var(--side-padding) * 2);
padding: 0 var(--side-padding);
text-align: center;
}
.icons-container {
align-items: center;
display: flex;
justify-content: center;
margin-bottom: 24px;
}
.coder-svg,
.app-icon {
width: 80px;
}
.connect-symbol {
font-size: 40px;
font-weight: bold;
margin: 0 10px;
}
h1 {
font-weight: 700;
font-size: 36px;
margin-bottom: 8px;
}
p,
li {
color: #b2bfd7;
line-height: 140%;
}
.user-name {
2024-02-20 15:58:43 -08:00
font-weight: bold;
}
#scope-list {
list-style: none;
margin-top: 12px;
/* The container centres its text, which would stagger the left edges. */
text-align: left;
padding-left: 8px;
}
#scope-disclaimer {
font-size: 13px;
margin-top: 12px;
}
2024-02-20 15:58:43 -08:00
.button-group {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
margin-top: 24px;
}
.button-group a,
.button-group button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 16px;
border-radius: 4px;
border: 1px solid #2c3854;
text-decoration: none;
background: none;
font-size: inherit;
color: inherit;
width: 200px;
height: 42px;
cursor: pointer;
}
.button-group a:hover,
.button-group button:hover {
border-color: hsl(222, 31%, 40%);
}
.button-group .primary-button {
background-color: #2c3854;
}
</style>
</head>
<body>
<div class="container">
<div class="icons-container">
{{- if .AppIcon }}
<img class="app-icon" src="{{ .AppIcon }}" />
<div class="connect-symbol">+</div>
{{end}}
2025-10-06 12:14:35 -06:00
<img class="coder-svg" src="/icon/coder.svg" alt="Coder" />
2024-02-20 15:58:43 -08:00
</div>
<h1>Authorize {{ .AppName }}</h1>
{{- if not .Unrestricted }}
<p id="description">
Allow {{ .AppName }} to access your
<span class="user-name">{{ .Username }}</span> account with these
permissions?
</p>
{{- /* WebKit drops implicit list semantics when list-style is none,
leaving VoiceOver to announce the permissions as loose text. */}}
<ul id="scope-list" role="list">
{{- range .Scopes }}
<li role="listitem">{{ . }}</li>
{{- end }}
</ul>
{{- /* Scope identifiers read narrower than they grant: template:read
reaches every template in the deployment, not the one in play. */}}
<p id="scope-disclaimer">
These are technical permission names. Grant them only to an application
you trust.
</p>
{{- else }}
<p id="description">
2024-02-20 15:58:43 -08:00
Allow {{ .AppName }} to have full access to your
<span class="user-name">{{ .Username }}</span> account?
</p>
{{- end }}
<div class="button-group" id="button-group">
<form id="allow-form" method="POST" style="display: inline;">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}" />
<button type="submit" class="primary-button">Allow</button>
</form>
<a id="cancel-link" href="{{ .CancelURI }}">Cancel</a>
2024-02-20 15:58:43 -08:00
</div>
</div>
<script>
(function () {
var appName = "{{ .AppName }}";
var description = document.getElementById("description");
var buttonGroup = document.getElementById("button-group");
var allowForm = document.getElementById("allow-form");
var cancelLink = document.getElementById("cancel-link");
var scopeList = document.getElementById("scope-list");
var scopeDisclaimer = document.getElementById("scope-disclaimer");
function showFeedback(message) {
buttonGroup.style.display = "none";
if (scopeList) {
scopeList.style.display = "none";
}
if (scopeDisclaimer) {
scopeDisclaimer.style.display = "none";
}
description.textContent = message;
}
allowForm.addEventListener("submit", function (e) {
e.preventDefault();
showFeedback(
appName +
" is now authorized to access your account. This window can now be closed."
);
setTimeout(function () {
allowForm.submit();
}, 500);
});
cancelLink.addEventListener("click", function (e) {
e.preventDefault();
showFeedback(
appName +
" was denied access to your account. This window can now be closed."
);
setTimeout(function () {
window.location.href = cancelLink.href;
}, 500);
});
})();
</script>
2024-02-20 15:58:43 -08:00
</body>
</html>