Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frontend/src/pages/account/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>
<form v-if="!ssoCreated" id="ff-sign-up" class="max-w-md m-auto" @submit.prevent="registerUser()">
<p
v-if="settings['branding:account:signUpTopBanner']"
v-if="showTopBanner"
data-el="banner-text"
class="text-center -mt-6 pb-4 text-gray-400"
v-html="settings['branding:account:signUpTopBanner']"
Expand Down Expand Up @@ -132,6 +132,15 @@ export default {
splash () {
return this.settings['branding:account:signUpLeftBanner']
},
showTopBanner () {
// Only show the top banner if:
// - content has been configured for it and,
// - either, in a popup
// - or, no left banner configured
return !!this.settings['branding:account:signUpTopBanner'] && (
this.isPopup || !this.splash
)
},
isPopup () {
return isPopupContext(this.$route.query)
},
Expand Down
54 changes: 52 additions & 2 deletions test/e2e/frontend/cypress/tests/admin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,36 @@ describe('FlowFuse platform admin users', () => {
cy.get('[data-el="splash"]').should('not.exist')
})

it('can customise the content of the "Sign Up" screen', () => {
it('can customise the content of the "Sign Up" screen - splash only', () => {
cy.intercept('GET', '/api/*/settings').as('getSettings')

cy.visit('/admin/settings/general')
cy.wait('@getSettings')

cy.get('[data-el="banner"]').type('this is banner')
cy.get('[data-el="splash"]').type('<h1>Welcome to FlowFuse</h1>')
cy.get('[data-el="banner"]').clear()

cy.get('[data-action="save-settings"]').click()

cy.logout()

cy.visit('/')

cy.get('[data-action="sign-up"]').click()

cy.url().should('include', '/account/create')

cy.get('[data-el="banner-text"]').should('not.exist')
cy.get('[data-el="splash"]').contains('Welcome to FlowFuse')
})
it('can customise the content of the "Sign Up" screen - banner only', () => {
cy.intercept('GET', '/api/*/settings').as('getSettings')

cy.visit('/admin/settings/general')
cy.wait('@getSettings')

cy.get('[data-el="splash"]').clear()
cy.get('[data-el="banner"]').type('this is banner')

cy.get('[data-action="save-settings"]').click()

Expand All @@ -186,7 +208,35 @@ describe('FlowFuse platform admin users', () => {
cy.url().should('include', '/account/create')

cy.get('[data-el="banner-text"]').contains('this is banner')
cy.get('[data-el="splash"]').should('not.exist')
})
it('can customise the content of the "Sign Up" screen - splash and banner', () => {
cy.intercept('GET', '/api/*/settings').as('getSettings')

cy.visit('/admin/settings/general')
cy.wait('@getSettings')

cy.get('[data-el="banner"]').type('this is banner')
cy.get('[data-el="splash"]').type('<h1>Welcome to FlowFuse</h1>')

cy.get('[data-action="save-settings"]').click()

cy.logout()

cy.visit('/')

cy.get('[data-action="sign-up"]').click()

cy.url().should('include', '/account/create')

// For the regular page, with both configured, only the splash should be shown
cy.get('[data-el="banner-text"]').should('not.exist')
cy.get('[data-el="splash"]').contains('Welcome to FlowFuse')

// For the popup, with both configured, only the banner should be shown
cy.visit('/account/create?context=popup')
cy.get('[data-el="banner-text"]').contains('this is banner')
cy.get('[data-el="splash"]').should('not.exist')
})
})
})
Expand Down
Loading