Oauth 2 Flow UI (#1440)

* adjust existing sign-in flow

* test fetching of oauth client

* allow for apiversion override

* getAuthUrl refactor

* Adjust auth to accept complex url redirections

* introduce scopes

* accept oauth flow

* rename login/oauth to authorize

* conform to labrinth spec and oauth2 spec

* use cute icons for scope items

* applications pages

* Modal for copy client secret on creation

* rip out old state

* add authorizations

* add flow error state and implement feedback

* implement error notifications on error

* Client secret modal flow aligned with PAT copy

* Authorized scopes now aligned with Authorize screen

* Fix spelling and capitalization

* change redirect uris to include the input field

* refactor 2fa flow to be more stable

* visual adjustments for authorizations

* Fix empty field submission bug

* Add file upload for application icon

* Change shape of editing/create application

* replace icon with Avatar component

* Refactor authorization card styling

* UI feedback

* clean up spacing, styling

* Create a "Developer" section of user settings

* Fix spacing and scope access

* app description and url implementations

* clean up imports

* Update authorization endpoint

* Update placeholder URL in applications.vue

* Remove app information from authorization page

* Remove max scopes from application settings

* Fix import statement and update label styles

* Replace useless headers

* Update pages/auth/authorize.vue

Co-authored-by: Calum H. <contact@mineblock11.dev>

* Update pages/auth/authorize.vue

Co-authored-by: Calum H. <contact@mineblock11.dev>

* Finish PR

---------

Co-authored-by: Calum H. <contact@mineblock11.dev>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Carter
2023-12-04 19:26:50 -08:00
committed by GitHub
parent 6d70ced93a
commit 1f58aebb2b
11 changed files with 1380 additions and 21 deletions
+14 -8
View File
@@ -22,27 +22,27 @@
<h1>Sign in with</h1>
<section class="third-party">
<a class="btn" :href="getAuthUrl('discord')">
<a class="btn" :href="getAuthUrl('discord', redirectTarget)">
<DiscordIcon />
<span>Discord</span>
</a>
<a class="btn" :href="getAuthUrl('github')">
<a class="btn" :href="getAuthUrl('github', redirectTarget)">
<GitHubIcon />
<span>GitHub</span>
</a>
<a class="btn" :href="getAuthUrl('microsoft')">
<a class="btn" :href="getAuthUrl('microsoft', redirectTarget)">
<MicrosoftIcon />
<span>Microsoft</span>
</a>
<a class="btn" :href="getAuthUrl('google')">
<a class="btn" :href="getAuthUrl('google', redirectTarget)">
<GoogleIcon />
<span>Google</span>
</a>
<a class="btn" :href="getAuthUrl('steam')">
<a class="btn" :href="getAuthUrl('steam', redirectTarget)">
<SteamIcon />
<span>Steam</span>
</a>
<a class="btn" :href="getAuthUrl('gitlab')">
<a class="btn" :href="getAuthUrl('gitlab', redirectTarget)">
<GitLabIcon />
<span>GitLab</span>
</a>
@@ -111,6 +111,8 @@ useHead({
const auth = await useAuth()
const route = useRoute()
const redirectTarget = route.query.redirect || ''
if (route.fullPath.includes('new_account=true')) {
await navigateTo(
`/auth/welcome?authToken=${route.query.code}${
@@ -122,7 +124,7 @@ if (route.fullPath.includes('new_account=true')) {
}
if (auth.value.user) {
await navigateTo('/dashboard')
await finishSignIn()
}
const turnstile = ref()
@@ -190,6 +192,7 @@ async function begin2FASignIn() {
}
stopLoading()
}
async function finishSignIn(token) {
if (token) {
await useAuth(token)
@@ -197,7 +200,10 @@ async function finishSignIn(token) {
}
if (route.query.redirect) {
await navigateTo(route.query.redirect)
const redirect = decodeURIComponent(route.query.redirect)
await navigateTo(redirect, {
replace: true,
})
} else {
await navigateTo('/dashboard')
}