2022-04-22 09:49:26 -04:00
|
|
|
import useFetchMock from '../hooks/use-fetch-mock'
|
|
|
|
import PasswordSection from '../../js/features/settings/components/password-section'
|
|
|
|
import { setDefaultMeta, defaultSetupMocks } from './helpers/password'
|
2024-06-18 06:01:37 -04:00
|
|
|
import getMeta from '@/utils/meta'
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
export const Success = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
|
|
|
return <PasswordSection {...args} />
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ManagedExternally = args => {
|
|
|
|
setDefaultMeta()
|
2024-06-18 06:01:37 -04:00
|
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
2022-04-22 09:49:26 -04:00
|
|
|
isOverleaf: false,
|
|
|
|
})
|
|
|
|
window.metaAttributesCache.set('ol-isExternalAuthenticationSystemUsed', true)
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
|
|
|
return <PasswordSection {...args} />
|
|
|
|
}
|
|
|
|
|
|
|
|
export const NoExistingPassword = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
window.metaAttributesCache.set('ol-hasPassword', false)
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
|
|
|
return <PasswordSection {...args} />
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Error = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(fetchMock =>
|
|
|
|
fetchMock.post(/\/user\/password\/update/, {
|
|
|
|
status: 400,
|
|
|
|
body: {
|
|
|
|
message: 'Your old password is wrong',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
return <PasswordSection {...args} />
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Account Settings / Password',
|
|
|
|
component: PasswordSection,
|
|
|
|
}
|