s/PleromaFE/AkkomaFE

Signed-off-by: r3g_5z <june@girlboss.ceo>
This commit is contained in:
r3g_5z 2023-01-07 21:53:49 -05:00
parent 39ea2e145b
commit 305db6608a
No known key found for this signature in database
6 changed files with 37 additions and 37 deletions

View file

@ -93,15 +93,15 @@ export default {
login: {
title: 'Login Form',
logIn: 'Log in',
logInViaPleromaFE: 'Log in via PleromaFE',
logInViaAkkomaFE: 'Log in via AkkomaFE',
username: 'username@host',
password: 'password',
omitHostname: 'Omit hostname if Pleroma is located on this domain',
errorMessage: 'Username must contain username and host, e.g. john@pleroma.social',
omitHostname: 'Omit hostname if Akkoma is located on this domain',
errorMessage: 'Username must contain username and host, e.g. user@instance.tld',
any: 'any',
thirdparty: 'Or connect with',
pleromaFELoginFailed: 'Failed to login via PleromaFE, please login with username/password',
pleromaFELoginSucceed: 'Logged in via PleromaFE'
akkomaFELoginFailed: 'Failed to login via AkkomaFE, please login with username/password',
akkomaFELoginSucceed: 'Logged in via AkkomaFE'
},
mediaProxyCache: {
mediaProxyCache: 'MediaProxy Cache',

View file

@ -1,15 +1,15 @@
import localforage from 'localforage'
import _ from 'lodash'
const pleromaFEStateKey = 'vuex-lz'
const akkomaFEStateKey = 'vuex-lz'
export const authenticateWithPleromaFE = async(store) => {
const pleromaFEState = await localforage.getItem(pleromaFEStateKey)
const token = _.get(pleromaFEState, 'oauth.userToken')
export const authenticateWithAkkomaFE = async(store) => {
const akkomaFEState = await localforage.getItem(akkomaFEStateKey)
const token = _.get(akkomaFEState, 'oauth.userToken')
if (token === undefined) {
throw new Error('PleromaFE token not found')
throw new Error('AkkomaFE token not found')
}
await store.dispatch('LoginByPleromaFE', { token })
await store.dispatch('LoginByAkkomaFE', { token })
}

View file

@ -83,7 +83,7 @@ const user = {
getUserInfo(state.token, state.authHost).then(response => {
const data = response.data
const message = '<span>This user doesn\`t have admin rights. Try another credentials or see the </span>' +
'<u><a target="_blank" href="https://docs.pleroma.social/backend/administration/CLI_tasks/user/#set-the-value-of-the-given-users-settings">docs</a></u>' +
'<u><a target="_blank" href="https://docs.akkoma.dev/stable/administration/CLI_tasks/user/#set-the-value-of-the-given-users-settings">docs</a></u>' +
'<span> to find out how to make this user an admin</span>'
if (!data) {
@ -120,7 +120,7 @@ const user = {
resolve()
})
},
async LoginByPleromaFE({ commit, dispatch }, { token }) {
async LoginByAkkomaFE({ commit, dispatch }, { token }) {
commit('SET_TOKEN', token)
setToken(token)
commit('SET_AUTH_HOST', window.location.host)

View file

@ -41,9 +41,9 @@
<el-button :loading="loading" class="login-button" type="primary" @click.native.prevent="handleLogin">
{{ $t('login.logIn') }}
</el-button>
<!-- Note: PleromaFE login feature relies on admin scope presence in PleromaFE token (older versions of PleromaFE don't support it) -->
<el-button v-if="pleromaFEToken" :loading="loadingPleromaFE" class="login-button" type="primary" @click.native.prevent="handlePleromaFELogin">
{{ $t('login.logInViaPleromaFE') }}
<!-- Note: AkkomaFE login feature relies on admin scope presence in AkkomaFE token (older versions of AkkomaFE don't support it) -->
<el-button v-if="akkomaFEToken" :loading="loadingAkkomaFE" class="login-button" type="primary" @click.native.prevent="handleAkkomaFELogin">
{{ $t('login.logInViaAkkomaFE') }}
</el-button>
</el-form>
</div>
@ -54,7 +54,7 @@ import SvgIcon from '@/components/element-ui/SvgIcon'
import localforage from 'localforage'
import _ from 'lodash'
import i18n from '@/lang'
import { authenticateWithPleromaFE } from '@/services/pleromaAuth'
import { authenticateWithAkkomaFE } from '@/services/pleromaAuth'
export default {
name: 'Login',
@ -67,12 +67,12 @@ export default {
},
passwordType: 'password',
loading: false,
loadingPleromaFE: false,
loadingAkkomaFE: false,
showDialog: false,
redirect: undefined,
pleromaFEToken: false,
pleromaFEStateKey: 'vuex-lz',
pleromaFEState: {}
akkomaFEToken: false,
akkomaFEStateKey: 'vuex-lz',
akkomaFEState: {}
}
},
watch: {
@ -84,14 +84,14 @@ export default {
}
},
async mounted() {
const pleromaFEState = await localforage.getItem(this.pleromaFEStateKey)
this.pleromaFEState = pleromaFEState
const akkomaFEState = await localforage.getItem(this.akkomaFEStateKey)
this.akkomaFEState = akkomaFEState
if (_.get(pleromaFEState, 'oauth.userToken') === undefined) {
if (_.get(akkomaFEState, 'oauth.userToken') === undefined) {
return
}
this.pleromaFEToken = true
this.akkomaFEToken = true
},
methods: {
showPwd() {
@ -111,18 +111,18 @@ export default {
this.loading = false
})
},
async handlePleromaFELogin() {
this.loadingPleromaFE = true
async handleAkkomaFELogin() {
this.loadingAkkomaFE = true
try {
await authenticateWithPleromaFE(this.$store)
await authenticateWithAkkomaFE(this.$store)
} catch (error) {
this.loadingPleromaFE = false
this.$message.error(i18n.t('login.pleromaFELoginFailed'))
this.loadingAkkomaFE = false
this.$message.error(i18n.t('login.akkomaFELoginFailed'))
}
this.loadingPleromaFE = false
this.loadingAkkomaFE = false
this.$message.success(i18n.t('login.pleromaFELoginSucceed'))
this.$message.success(i18n.t('login.akkomaFELoginSucceed'))
this.$router.push({ path: this.redirect || '/users/index' })
},
getLoginData() {

View file

@ -4,7 +4,7 @@
<script>
import { Loading } from 'element-ui'
import { authenticateWithPleromaFE } from '@/services/pleromaAuth'
import { authenticateWithAkkomaFE } from '@/services/pleromaAuth'
import i18n from '@/lang'
export default {
@ -13,14 +13,14 @@ export default {
const loadingInstance = Loading.service({ fullscreen: true })
try {
await authenticateWithPleromaFE(this.$store)
await authenticateWithAkkomaFE(this.$store)
} catch (error) {
this.$message.error(i18n.t('login.pleromaFELoginFailed'))
this.$message.error(i18n.t('login.akkomaFELoginFailed'))
}
loadingInstance.close()
this.$router.push({ path: '/users/index' })
this.$message.success(i18n.t('login.pleromaFELoginSucceed'))
this.$message.success(i18n.t('login.akkomaFELoginSucceed'))
}
}
</script>

View file

@ -36,7 +36,7 @@
<h1 class="settings-header">{{ $t('settings.settings') }}</h1>
<el-link
:underline="false"
href="https://docs-develop.pleroma.social/backend/administration/CLI_tasks/config/"
href="https://docs.akkoma.dev/stable/administration/CLI_tasks/config/"
target="_blank">
<el-button class="settings-docs-button">
<span>