Skip to content

Commit 0ebd93f

Browse files
committed
fix: remove basic auth
1 parent afa24cc commit 0ebd93f

7 files changed

Lines changed: 52 additions & 187 deletions

File tree

packages/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
"csv-parser": "^3.0.0",
102102
"dotenv": "^16.0.0",
103103
"express": "^4.17.3",
104-
"express-basic-auth": "^1.2.1",
105104
"express-mysql-session": "^3.0.3",
106105
"express-rate-limit": "^6.9.0",
107106
"express-session": "^1.18.1",

packages/server/src/enterprise/controllers/account.controller.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,4 @@ export class AccountController {
112112
next(error)
113113
}
114114
}
115-
116-
public async getBasicAuth(req: Request, res: Response) {
117-
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
118-
return res.status(StatusCodes.OK).json({
119-
isUsernamePasswordSet: true
120-
})
121-
} else {
122-
return res.status(StatusCodes.OK).json({
123-
isUsernamePasswordSet: false
124-
})
125-
}
126-
}
127-
128-
public async checkBasicAuth(req: Request, res: Response) {
129-
const { username, password } = req.body
130-
if (username === process.env.FLOWISE_USERNAME && password === process.env.FLOWISE_PASSWORD) {
131-
return res.json({ message: 'Authentication successful' })
132-
} else {
133-
return res.json({ message: 'Authentication failed' })
134-
}
135-
}
136115
}

packages/server/src/enterprise/routes/account.route.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,4 @@ router.post('/reset-password', accountController.resetPassword)
3030

3131
router.post('/billing', accountController.createStripeCustomerPortalSession)
3232

33-
router.get('/basic-auth', accountController.getBasicAuth)
34-
35-
router.post('/basic-auth', accountController.checkBasicAuth)
36-
3733
export default router

packages/server/src/utils/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const WHITELIST_URLS = [
3232
'/api/v1/account/resend-verification',
3333
'/api/v1/account/forgot-password',
3434
'/api/v1/account/reset-password',
35-
'/api/v1/account/basic-auth',
3635
'/api/v1/loginmethod',
3736
'/api/v1/pricing',
3837
'/api/v1/user/test',

packages/ui/src/api/account.api.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const forgotPassword = (body) => client.post('/account/forgot-password', body)
88
const resetPassword = (body) => client.post('/account/reset-password', body)
99
const getBillingData = () => client.post('/account/billing')
1010
const logout = () => client.post('/account/logout')
11-
const getBasicAuth = () => client.get('/account/basic-auth')
12-
const checkBasicAuth = (body) => client.post('/account/basic-auth', body)
1311

1412
export default {
1513
getBillingData,
@@ -19,7 +17,5 @@ export default {
1917
resendVerificationEmail,
2018
forgotPassword,
2119
resetPassword,
22-
logout,
23-
getBasicAuth,
24-
checkBasicAuth
20+
logout
2521
}

packages/ui/src/views/organization/index.jsx

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,13 @@ const OrganizationSetupPage = () => {
9191
const [confirmPassword, setConfirmPassword] = useState('')
9292
const [username, setUsername] = useState('')
9393
const [orgName, setOrgName] = useState('')
94-
const [existingUsername, setExistingUsername] = useState('')
95-
const [existingPassword, setExistingPassword] = useState('')
9694

9795
const [loading, setLoading] = useState(false)
9896
const [authError, setAuthError] = useState('')
9997
const [successMsg, setSuccessMsg] = useState(undefined)
100-
const [requiresAuthentication, setRequiresAuthentication] = useState(false)
10198

10299
const loginApi = useApi(authApi.login)
103100
const registerAccountApi = useApi(accountApi.registerAccount)
104-
const getBasicAuthApi = useApi(accountApi.getBasicAuth)
105101
const navigate = useNavigate()
106102

107103
const getDefaultProvidersApi = useApi(loginMethodApi.getLoginMethods)
@@ -120,26 +116,6 @@ const OrganizationSetupPage = () => {
120116
setLoading(true)
121117
setAuthError('')
122118

123-
// Check authentication first if required
124-
if (requiresAuthentication) {
125-
try {
126-
const authResult = await accountApi.checkBasicAuth({
127-
username: existingUsername,
128-
password: existingPassword
129-
})
130-
131-
if (!authResult || !authResult.data || authResult.data.message !== 'Authentication successful') {
132-
setAuthError('Authentication failed. Please check your existing credentials.')
133-
setLoading(false)
134-
return
135-
}
136-
} catch (error) {
137-
setAuthError('Authentication failed. Please check your existing credentials.')
138-
setLoading(false)
139-
return
140-
}
141-
}
142-
143119
// Proceed with registration after successful authentication
144120
const body = {
145121
user: {
@@ -180,17 +156,9 @@ const OrganizationSetupPage = () => {
180156
// eslint-disable-next-line react-hooks/exhaustive-deps
181157
}, [registerAccountApi.error])
182158

183-
useEffect(() => {
184-
if (getBasicAuthApi.data && getBasicAuthApi.data.isUsernamePasswordSet === true) {
185-
setRequiresAuthentication(true)
186-
}
187-
}, [getBasicAuthApi.data])
188-
189159
useEffect(() => {
190160
if (!isOpenSource) {
191161
getDefaultProvidersApi.request()
192-
} else {
193-
getBasicAuthApi.request()
194162
}
195163
// eslint-disable-next-line react-hooks/exhaustive-deps
196164
}, [])
@@ -271,60 +239,13 @@ const OrganizationSetupPage = () => {
271239
<Stack sx={{ gap: 1 }}>
272240
<Typography variant='h1'>Setup Account</Typography>
273241
</Stack>
274-
{requiresAuthentication && (
275-
<Alert severity='info'>
276-
Application authentication now requires email and password. Contact administrator to setup an account.
277-
</Alert>
278-
)}
279242
{(isOpenSource || isEnterpriseLicensed) && (
280243
<Typography variant='caption'>
281244
Account setup does not make any external connections, your data stays securely on your locally hosted server.
282245
</Typography>
283246
)}
284247
<form onSubmit={register}>
285248
<Stack sx={{ width: '100%', flexDirection: 'column', alignItems: 'left', justifyContent: 'center', gap: 2 }}>
286-
{requiresAuthentication && (
287-
<>
288-
<Box>
289-
<div style={{ display: 'flex', flexDirection: 'row' }}>
290-
<Typography sx={{ mb: 1 }}>
291-
Existing Username<span style={{ color: 'red' }}>&nbsp;*</span>
292-
</Typography>
293-
<div style={{ flexGrow: 1 }}></div>
294-
</div>
295-
<TextField
296-
fullWidth
297-
placeholder='Existing Username'
298-
value={existingUsername}
299-
onChange={(e) => setExistingUsername(e.target.value)}
300-
/>
301-
<Typography variant='caption'>
302-
<i>Existing username that was set as FLOWISE_USERNAME environment variable</i>
303-
</Typography>
304-
</Box>
305-
<Box>
306-
<div style={{ display: 'flex', flexDirection: 'row' }}>
307-
<Typography sx={{ mb: 1 }}>
308-
Existing Password<span style={{ color: 'red' }}>&nbsp;*</span>
309-
</Typography>
310-
<div style={{ flexGrow: 1 }}></div>
311-
</div>
312-
<TextField
313-
fullWidth
314-
type='password'
315-
placeholder='Existing Password'
316-
value={existingPassword}
317-
onChange={(e) => setExistingPassword(e.target.value)}
318-
/>
319-
<Typography variant='caption'>
320-
<i>Existing password that was set as FLOWISE_PASSWORD environment variable</i>
321-
</Typography>
322-
</Box>
323-
<Divider>
324-
<Chip label='New Account Details' size='small' />
325-
</Divider>
326-
</>
327-
)}
328249
{isEnterpriseLicensed && (
329250
<>
330251
<Box>
@@ -416,12 +337,7 @@ const OrganizationSetupPage = () => {
416337
<i>Reconfirm your password. Must match the password typed above.</i>
417338
</Typography>
418339
</Box>
419-
<StyledButton
420-
variant='contained'
421-
style={{ borderRadius: 12, height: 40, marginRight: 5 }}
422-
type='submit'
423-
disabled={requiresAuthentication && (!existingUsername || !existingPassword)}
424-
>
340+
<StyledButton variant='contained' style={{ borderRadius: 12, height: 40, marginRight: 5 }} type='submit'>
425341
Sign Up
426342
</StyledButton>
427343
{configuredSsoProviders && configuredSsoProviders.length > 0 && <Divider sx={{ width: '100%' }}>OR</Divider>}

0 commit comments

Comments
 (0)