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
8 changes: 6 additions & 2 deletions enterprise/web-frontend/modules/baserow_enterprise/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ export default defineNuxtModule({
})

// Add login pages as children of login-pages (inherit login layout)
const loginPagesRoute = pages.find((route) => route.name === 'login-pages')
const loginPagesRoute = pages.find(
(route) => route.name === 'login-pages'
)
if (loginPagesRoute) {
routes.forEach((route) => {
if (!loginPagesRoute.children.find(({ name }) => name === route.name)) {
if (
!loginPagesRoute.children.find(({ name }) => name === route.name)
) {
loginPagesRoute.children.push(route)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,65 +156,61 @@ const login = async () => {
}

// Async data fetching
const { data: asyncData } = await useAsyncData(
'saml-login',
async () => {
// the SuperUser must create the account using username and password
if (store.getters['settings/get'].show_admin_signup_page === true) {
await navigateTo({ name: 'signup' })
return {}
}
const { data: asyncData } = await useAsyncData('saml-login', async () => {
// the SuperUser must create the account using username and password
if (store.getters['settings/get'].show_admin_signup_page === true) {
await navigateTo({ name: 'signup' })
return {}
}

// if this page is accessed directly, load the login options to
// populate the page with all the authentication providers
if (!store.getters['authProvider/getLoginOptionsLoaded']) {
await store.dispatch('authProvider/fetchLoginOptions')
}
// if this page is accessed directly, load the login options to
// populate the page with all the authentication providers
if (!store.getters['authProvider/getLoginOptionsLoaded']) {
await store.dispatch('authProvider/fetchLoginOptions')
}

const samlLoginOptions =
store.getters['authProvider/getLoginOptionsForType'](
new SamlAuthProviderType().getType()
)
const samlLoginOptions = store.getters['authProvider/getLoginOptionsForType'](
new SamlAuthProviderType().getType()
)

if (!samlLoginOptions) {
await navigateTo({ name: 'login', query: route.query }) // no SAML provider enabled
return {}
}
if (!samlLoginOptions) {
await navigateTo({ name: 'login', query: route.query }) // no SAML provider enabled
return {}
}

// Fetch workspace invitation if token exists
let invitation = null
const invitationToken = route.query.workspaceInvitationToken
if (invitationToken) {
try {
const { data } =
await WorkspaceService($client).fetchInvitationByToken(invitationToken)
invitation = data
} catch {}
}
// Fetch workspace invitation if token exists
let invitation = null
const invitationToken = route.query.workspaceInvitationToken
if (invitationToken) {
try {
const { data } =
await WorkspaceService($client).fetchInvitationByToken(invitationToken)
invitation = data
} catch {}
}

// in case the email is not necessary or provided via workspace invitation,
// redirect the user directly to the SAML provider
if (!samlLoginOptions.domainRequired || invitation?.email) {
try {
const { data } = await samlAuthProviderService($client).getSamlLoginUrl({
email: invitation?.email,
original: route.query.original,
})
return {
redirectImmediately: true,
redirectUrl: data.redirect_url,
}
} catch (error) {
return {
email: invitation?.email,
loginRequestError: true,
}
// in case the email is not necessary or provided via workspace invitation,
// redirect the user directly to the SAML provider
if (!samlLoginOptions.domainRequired || invitation?.email) {
try {
const { data } = await samlAuthProviderService($client).getSamlLoginUrl({
email: invitation?.email,
original: route.query.original,
})
return {
redirectImmediately: true,
redirectUrl: data.redirect_url,
}
} catch (error) {
return {
email: invitation?.email,
loginRequestError: true,
}
}

return { redirectUrl: samlLoginOptions.redirect_url }
}
)

return { redirectUrl: samlLoginOptions.redirect_url }
})

// Apply async data results
if (asyncData.value?.redirectImmediately) {
Expand Down
36 changes: 34 additions & 2 deletions web-frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
modules/core/templates
**/locales/*.json
# Nuxt build outputs
.nuxt/
.output/
.nitro/
dist/

# Dependencies
node_modules/

# Cache
.cache/

# Coverage
coverage/

# Logs
*.log

# Lock files
yarn.lock
package-lock.json
pnpm-lock.yaml

# Generated files
**/generated/**

# Project-specific
modules/core/templates/
modules/core/formula/parser/
modules/core/assets/scss/vendor/
**/locales/*.json

# Storybook
.nuxt-storybook/
storybook-static/
4 changes: 2 additions & 2 deletions web-frontend/eslint.config.common.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import withNuxt from './.nuxt/eslint.config.mjs'

import globals from 'globals'
import vitest from 'eslint-plugin-vitest'
import prettier from 'eslint-config-prettier'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
{
Expand All @@ -15,7 +15,7 @@ export default [
'.nuxt-storybook/**',
],
},
prettier,
eslintConfigPrettier, // deactivate eslint rules that conflict with prettier
{
languageOptions: {
globals: {
Expand Down
17 changes: 10 additions & 7 deletions web-frontend/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,25 @@ install:
# Code Quality & Linting
# =============================================================================

# Run all linters (eslint + stylelint)
# Run all linters (eslint + stylelint + prettier)
[group('4 - code-quality')]
lint:
yarn run eslint
yarn run stylelint
yarn run prettier --check 'modules/**/*.scss'
yarn run lint

# Fix code style issues
[group('4 - code-quality')]
fix:
yarn run fix

# Format SCSS files with Prettier
# Check formatting with Prettier
[group('4 - code-quality')]
format-scss:
yarn run prettier --write 'modules/**/*.scss'
prettier-check:
yarn run prettier:check

# Format all files with Prettier
[group('4 - code-quality')]
format:
yarn run format

# =============================================================================
# Testing
Expand Down
7 changes: 6 additions & 1 deletion web-frontend/modules/core/components/auth/PasswordLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ export default {
default: true,
},
},
emits: ['email-not-verified', 'success', 'two-factor-auth', 'invitation-accepted'],
emits: [
'email-not-verified',
'success',
'two-factor-auth',
'invitation-accepted',
],
setup() {
const values = reactive({
values: {
Expand Down
4 changes: 3 additions & 1 deletion web-frontend/modules/core/pages/signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ const { data: invitation } = await useAsyncData(
if (invitationToken) {
try {
const { data } =
await WorkspaceService($client).fetchInvitationByToken(invitationToken)
await WorkspaceService($client).fetchInvitationByToken(
invitationToken
)
return data
} catch {
return null
Expand Down
5 changes: 3 additions & 2 deletions web-frontend/modules/core/pages/workspaceInvitation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ if (invitation.value) {
) {
try {
// Accept the invitation - returns the workspace data
const { data: workspace } =
await WorkspaceService($client).acceptInvitation(inv.id)
const { data: workspace } = await WorkspaceService(
$client
).acceptInvitation(inv.id)

// Clear workspace loaded state so it gets refetched on next page
store.commit('workspace/SET_LOADED', false)
Expand Down
5 changes: 1 addition & 4 deletions web-frontend/modules/core/store/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ export const actions = {
* Authenticate a user by his email and password.
*/
async login({ getters, dispatch }, { email, password }) {
const { data } = await AuthService(this.$client).login(
email,
password
)
const { data } = await AuthService(this.$client).login(email, password)
return dispatch('loginWithData', { data })
},
/**
Expand Down
3 changes: 2 additions & 1 deletion web-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"test:enterprise": "TZ=UTC NODE_OPTIONS=\"--max-old-space-size=8192\" vitest $EXTRA_VITEST_PARAMS --config ../enterprise/web-frontend/vitest.config.ts",
"test:enterprise:coverage": "TZ=UTC NODE_OPTIONS=\"--max-old-space-size=8192\" vitest $EXTRA_VITEST_PARAMS --config ../enterprise/web-frontend/vitest.config.ts --coverage",
"postinstall": "nuxt prepare",
"lint": "yarn eslint && yarn stylelint",
"lint": "yarn eslint && yarn stylelint && yarn prettier:check",
"prettier:check": "prettier --check . ../premium/web-frontend ../enterprise/web-frontend",
"eslint": "yarn postinstall && yarn eslint:core && yarn eslint:premium && yarn eslint:enterprise",
"stylelint": "stylelint --cache --cache-location=.cache/stylelint **/*.scss ../premium/web-frontend/modules/**/*.scss ../enterprise/web-frontend/modules/**/*.scss",
"eslint:fix": "yarn eslint:core --fix && yarn eslint:premium --fix && yarn eslint:enterprise --fix",
Expand Down
31 changes: 3 additions & 28 deletions web-frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9744,16 +9744,7 @@ string-argv@~0.3.1:
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6"
integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -9785,14 +9776,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -10986,16 +10970,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down
Loading