Redirect to account page for account password reset (#15404)

This commit is contained in:
melohagan 2025-01-21 13:32:18 +00:00 committed by GitHub
parent 655332715d
commit 0fbcfcd33c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 3 deletions

View File

@ -15,6 +15,7 @@
import { import {
appsStore, appsStore,
organisation, organisation,
admin,
auth, auth,
groups, groups,
licensing, licensing,
@ -42,6 +43,7 @@
app => app.status === AppStatus.DEPLOYED app => app.status === AppStatus.DEPLOYED
) )
$: userApps = getUserApps(publishedApps, userGroups, $auth.user) $: userApps = getUserApps(publishedApps, userGroups, $auth.user)
$: isOwner = $auth.accountPortalAccess && $admin.cloud
function getUserApps(publishedApps, userGroups, user) { function getUserApps(publishedApps, userGroups, user) {
if (sdk.users.isAdmin(user)) { if (sdk.users.isAdmin(user)) {
@ -111,7 +113,13 @@
</MenuItem> </MenuItem>
<MenuItem <MenuItem
icon="LockClosed" icon="LockClosed"
on:click={() => changePasswordModal.show()} on:click={() => {
if (isOwner) {
window.location.href = `${$admin.accountPortalUrl}/portal/account`
} else {
changePasswordModal.show()
}
}}
> >
Update password Update password
</MenuItem> </MenuItem>

View File

@ -1,5 +1,5 @@
<script> <script>
import { auth } from "@/stores/portal" import { admin, auth } from "@/stores/portal"
import { ActionMenu, MenuItem, Icon, Modal } from "@budibase/bbui" import { ActionMenu, MenuItem, Icon, Modal } from "@budibase/bbui"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import ProfileModal from "@/components/settings/ProfileModal.svelte" import ProfileModal from "@/components/settings/ProfileModal.svelte"
@ -13,6 +13,8 @@
let updatePasswordModal let updatePasswordModal
let apiKeyModal let apiKeyModal
$: isOwner = $auth.accountPortalAccess && $admin.cloud
const logout = async () => { const logout = async () => {
try { try {
await auth.logout() await auth.logout()
@ -32,7 +34,16 @@
</MenuItem> </MenuItem>
<MenuItem icon="Moon" on:click={() => themeModal.show()}>Theme</MenuItem> <MenuItem icon="Moon" on:click={() => themeModal.show()}>Theme</MenuItem>
{#if !$auth.isSSO} {#if !$auth.isSSO}
<MenuItem icon="LockClosed" on:click={() => updatePasswordModal.show()}> <MenuItem
icon="LockClosed"
on:click={() => {
if (isOwner) {
window.location.href = `${$admin.accountPortalUrl}/portal/account`
} else {
updatePasswordModal.show()
}
}}
>
Update password Update password
</MenuItem> </MenuItem>
{/if} {/if}