Skip to content

Commit

Permalink
Fixes org & role onboarding setup for basic auth (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushchris authored Apr 1, 2024
1 parent 347f2fa commit 6649f40
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions apps/platform/src/auth/BasicAuthProvider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Context } from 'koa'
import { AuthTypeConfig } from './Auth'
import { getAdminByEmail } from './AdminRepository'
import AuthProvider from './AuthProvider'
import App from '../app'
import { combineURLs, firstQueryParam } from '../utilities'
import Admin from './Admin'
import { RequestError } from '../core/errors'
import AuthError from './AuthError'

Expand Down Expand Up @@ -40,13 +38,7 @@ export default class BasicAuthProvider extends AuthProvider {
throw new RequestError(AuthError.InvalidCredentials)
}

// Find admin, otherwise first time, create
let admin = await getAdminByEmail(email)
if (!admin) {
admin = await Admin.insertAndFetch({ email, first_name: 'Admin' })
}

// Process the login
await this.login({ email, domain: 'local' }, ctx)
await this.login({ email, first_name: 'Admin', domain: 'local' }, ctx)
}
}

0 comments on commit 6649f40

Please sign in to comment.