fix(server): Allow passwordless users when oauth enabled (#13517)

* fix(server): Allow passwordless users when oauth enabled

* fix(web): Use features flags for checking oauth
This commit is contained in:
jedi04 2024-10-17 21:54:50 +05:30 committed by GitHub
parent 3f663106e8
commit bb694aeeeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 4 deletions

View file

@ -26,6 +26,10 @@ export class UserAdminService extends BaseService {
async create(dto: UserAdminCreateDto): Promise<UserAdminResponseDto> {
const { notify, ...rest } = dto;
const config = await this.getConfig({ withCache: false });
if (!config.oauth.enabled && !rest.password) {
throw new BadRequestException('password is required');
}
const user = await createUser({ userRepo: this.userRepository, cryptoRepo: this.cryptoRepository }, rest);
await this.eventRepository.emit('user.signup', {