feat: redirect to signup

This commit is contained in:
Ayo 2024-03-16 09:35:38 +01:00
parent 6589017e09
commit d294da1d32
5 changed files with 7 additions and 24 deletions

View file

@ -26,28 +26,22 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
:disabled="busy"
@click="oauth('signup')"
>
hey
<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>
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
{{ $t('action.sign_up') }}
</button>
<button
v-if="singleInstanceServer"
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"
@click="oauth('signin')"
@click="oauth('login')"
>
hey
<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>
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
<i18n-t keypath="action.sign_in_to">
<strong>{{ currentServer }}</strong>
</i18n-t>
{{ $t('action.sign_in') }}
</button>
<button v-else btn-solid text-sm px-2 py-1 text-center xl:hidden @click="openSigninDialog()">
{{ $t('action.sign_in') }}

View file

@ -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 block i-ri:loader-2-fill aria-hidden="true" />
</span>
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
{{ $t('action.sign_up') }}
</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 block i-ri:loader-2-fill aria-hidden="true" />
</span>
<span v-else aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
{{ $t('action.sign_in') }}
</button>
<button v-else btn-solid rounded-3 text-center mt-2 select-none @click="openSigninDialog()">

View file

@ -81,7 +81,7 @@
"save_changes": "Save changes",
"sign_in": "Sign in",
"sign_in_to": "Sign in to {0}",
"sign_up": "Sign up",
"sign_up": "Create an account",
"switch_account": "Switch account",
"vote": "Vote"
},

View file

@ -162,7 +162,7 @@ export default defineNuxtConfig({
// our default translation server #76
translateApi: '',
// Use the instance where Elk has its Mastodon account as the default
defaultServer: 'social.ayco.io',
defaultServer: 'mastodon.social',
singleInstance: true,
},
storage: {

View file

@ -2,7 +2,7 @@ import { stringifyQuery } from 'ufo'
export default defineEventHandler(async (event) => {
let { server } = getRouterParams(event)
const { origin, force_login, lang } = await readBody(event)
const { origin } = await readBody(event)
server = server.toLocaleLowerCase().trim()
const app = await getApp(origin, server)
@ -13,14 +13,5 @@ export default defineEventHandler(async (event) => {
})
}
const query = stringifyQuery({
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}`
return `https://${server}/auth/sign_up`
})