gradido_address link always gradido_id, static auto login humhub link

This commit is contained in:
einhornimmond 2024-05-30 16:47:58 +02:00
parent 39d4264422
commit af24b0ef05
4 changed files with 16 additions and 11 deletions

View File

@ -65,7 +65,7 @@ export class HumHubClient {
const token = await new SignJWT({ username })
.setProtectedHeader({ alg: 'HS256' })
.setIssuedAt()
.setExpirationTime('2m')
.setExpirationTime(CONFIG.JWT_EXPIRES_IN)
.sign(secret)
return `${CONFIG.HUMHUB_API_URL}user/auth/external?authclient=jwt&jwt=${token}`

View File

@ -10,11 +10,7 @@ export class Profile {
const publishNameLogic = new PublishNameLogic(user)
this.firstname = publishNameLogic.getFirstName(user.humhubPublishName as PublishNameType)
this.lastname = publishNameLogic.getLastName(user.humhubPublishName as PublishNameType)
if (user.alias && user.alias.length > 2) {
this.gradido_address = CONFIG.COMMUNITY_NAME + '/' + user.alias
} else {
this.gradido_address = CONFIG.COMMUNITY_NAME + '/' + user.gradidoID
}
this.gradido_address = CONFIG.COMMUNITY_NAME + '/' + user.gradidoID
}
firstname: string

View File

@ -203,8 +203,13 @@ export class UserResolver {
await EVENT_USER_LOGIN(dbUser)
// load humhub state
if (humhubUserPromise) {
const result = await humhubUserPromise
user.humhubAllowed = result?.result?.account.status === 1
try {
const result = await humhubUserPromise
user.humhubAllowed = result?.result?.account.status === 1
} catch (e) {
logger.error("couldn't reach out to humhub, disable for now", e)
user.humhubAllowed = false
}
}
user.klickTipp = await klicktippStatePromise
logger.info(`successful Login: ${JSON.stringify(user, null, 2)}`)

View File

@ -12,10 +12,10 @@
<b-col cols="12">
<div class="text-lg-right">
<b-button
:href="this.humhubUri"
v-if="this.humhubAllowed"
variant="gradido"
:disabled="this.enableButton === false"
@click="authenticateHumhubAutoLogin"
target="_blank"
>
{{ $t('circles.button') }}
@ -37,7 +37,8 @@ export default {
name: 'Circles',
data() {
return {
enableButton: true,
enableButton: false,
humhubUri: '',
}
},
computed: {
@ -55,7 +56,7 @@ export default {
fetchPolicy: 'network-only',
})
.then(async (result) => {
window.open(result.data.authenticateHumhubAutoLogin, '_blank')
this.humhubUri = result.data.authenticateHumhubAutoLogin
this.enableButton = true
})
.catch(() => {
@ -67,5 +68,8 @@ export default {
})
},
},
created() {
this.authenticateHumhubAutoLogin()
},
}
</script>