mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-21 17:05:22 +03:00
feat: redirect to signup
This commit is contained in:
parent
6589017e09
commit
d294da1d32
5 changed files with 7 additions and 24 deletions
|
@ -26,28 +26,22 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
:disabled="busy"
|
:disabled="busy"
|
||||||
@click="oauth('signup')"
|
@click="oauth('signup')"
|
||||||
>
|
>
|
||||||
hey
|
|
||||||
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
<span block i-ri:loader-2-fill aria-hidden="true" />
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
|
||||||
{{ $t('action.sign_up') }}
|
{{ $t('action.sign_up') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="singleInstanceServer"
|
v-if="singleInstanceServer"
|
||||||
flex="~ row"
|
flex="~ row"
|
||||||
gap-x-1 items-center justify-center btn-solid text-sm px-2 py-1 xl:hidden
|
gap-x-1 items-center justify-center btn-outline text-sm px-2 py-1 xl:hidden
|
||||||
:disabled="busy"
|
:disabled="busy"
|
||||||
@click="oauth('signin')"
|
@click="oauth('login')"
|
||||||
>
|
>
|
||||||
hey
|
|
||||||
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
<span block i-ri:loader-2-fill aria-hidden="true" />
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
{{ $t('action.sign_in') }}
|
||||||
<i18n-t keypath="action.sign_in_to">
|
|
||||||
<strong>{{ currentServer }}</strong>
|
|
||||||
</i18n-t>
|
|
||||||
</button>
|
</button>
|
||||||
<button v-else btn-solid text-sm px-2 py-1 text-center xl:hidden @click="openSigninDialog()">
|
<button v-else btn-solid text-sm px-2 py-1 text-center xl:hidden @click="openSigninDialog()">
|
||||||
{{ $t('action.sign_in') }}
|
{{ $t('action.sign_in') }}
|
||||||
|
|
|
@ -23,7 +23,6 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
<span block i-ri:loader-2-fill aria-hidden="true" />
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
|
||||||
{{ $t('action.sign_up') }}
|
{{ $t('action.sign_up') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
@ -35,7 +34,6 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
<span v-if="busy" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
<span block i-ri:loader-2-fill aria-hidden="true" />
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
|
||||||
{{ $t('action.sign_in') }}
|
{{ $t('action.sign_in') }}
|
||||||
</button>
|
</button>
|
||||||
<button v-else btn-solid rounded-3 text-center mt-2 select-none @click="openSigninDialog()">
|
<button v-else btn-solid rounded-3 text-center mt-2 select-none @click="openSigninDialog()">
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
"save_changes": "Save changes",
|
"save_changes": "Save changes",
|
||||||
"sign_in": "Sign in",
|
"sign_in": "Sign in",
|
||||||
"sign_in_to": "Sign in to {0}",
|
"sign_in_to": "Sign in to {0}",
|
||||||
"sign_up": "Sign up",
|
"sign_up": "Create an account",
|
||||||
"switch_account": "Switch account",
|
"switch_account": "Switch account",
|
||||||
"vote": "Vote"
|
"vote": "Vote"
|
||||||
},
|
},
|
||||||
|
|
|
@ -162,7 +162,7 @@ export default defineNuxtConfig({
|
||||||
// our default translation server #76
|
// our default translation server #76
|
||||||
translateApi: '',
|
translateApi: '',
|
||||||
// Use the instance where Elk has its Mastodon account as the default
|
// Use the instance where Elk has its Mastodon account as the default
|
||||||
defaultServer: 'social.ayco.io',
|
defaultServer: 'mastodon.social',
|
||||||
singleInstance: true,
|
singleInstance: true,
|
||||||
},
|
},
|
||||||
storage: {
|
storage: {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { stringifyQuery } from 'ufo'
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
let { server } = getRouterParams(event)
|
let { server } = getRouterParams(event)
|
||||||
const { origin, force_login, lang } = await readBody(event)
|
const { origin } = await readBody(event)
|
||||||
server = server.toLocaleLowerCase().trim()
|
server = server.toLocaleLowerCase().trim()
|
||||||
const app = await getApp(origin, server)
|
const app = await getApp(origin, server)
|
||||||
|
|
||||||
|
@ -13,14 +13,5 @@ export default defineEventHandler(async (event) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = stringifyQuery({
|
return `https://${server}/auth/sign_up`
|
||||||
client_id: app.client_id,
|
|
||||||
force_login: force_login === true ? 'true' : 'false',
|
|
||||||
scope: 'read write follow push',
|
|
||||||
response_type: 'code',
|
|
||||||
lang,
|
|
||||||
redirect_uri: getRedirectURI(origin, server),
|
|
||||||
})
|
|
||||||
|
|
||||||
return `https://${server}/oauth/authorize?${query}`
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue