Skip to content

Commit

Permalink
Merge pull request #3326 from activepieces/minor-fixes-12-03-2023
Browse files Browse the repository at this point in the history
feat: Update USER_CREATED flag on sign-up, enable initial sign-up on EE, hide thrid-party authentication from EE, password reset styling improvement
  • Loading branch information
abuaboud committed Dec 3, 2023
2 parents 0a5576c + 89c48bd commit 660c50d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 15 deletions.
@@ -1,12 +1,11 @@
import { ApFlagId, PrincipalType, Project, ProjectType, User } from '@activepieces/shared'
import { PrincipalType, Project, ProjectType, User } from '@activepieces/shared'
import { projectService } from '../../../project/project-service'
import { flagService } from '../../../flags/flag.service'
import { AuthenticationServiceHooks } from './authentication-service-hooks'
import { accessTokenManager } from '../../lib/access-token-manager'

export const communityAuthenticationServiceHooks: AuthenticationServiceHooks = {
async postSignUp({ user }) {
await flagService.save({ id: ApFlagId.USER_CREATED, value: true })

const project = await projectService.create({
displayName: `${user.firstName}'s Project`,
ownerId: user.id,
Expand Down
Expand Up @@ -23,7 +23,7 @@ export const authenticationService = {
})

const userWithoutPassword = removePasswordPropFromUser(authnResponse.user)

await flagService.save({ id: ApFlagId.USER_CREATED, value: true })
await sendTelemetry({
user, project: authnResponse.project,
})
Expand Down
Expand Up @@ -29,12 +29,14 @@ export const enterpriseAuthenticationServiceHooks: AuthenticationServiceHooks =
type: ProjectType.STANDALONE,
})

await platformService.add({
const platform = await platformService.add({
ownerId: user.id,
projectId: project.id,
name: DEFAULT_PLATFORM_NAME,
})

await userService.updatePlatformId({ id: user.id, platformId: platform.id })

await flagService.save({
id: ApFlagId.PLATFORM_CREATED,
value: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/app/ee/flags/enterprise-flags.hooks.ts
@@ -1,4 +1,4 @@
import { ApFlagId, isNil } from '@activepieces/shared'
import { ApFlagId, isNil } from '@activepieces/shared'
import { FlagsServiceHooks } from '../../flags/flags.hooks'
import { apperanceHelper } from '../helper/apperance-helper'
import { platformService } from '../platform/platform.service'
Expand All @@ -20,7 +20,7 @@ export const enterpriseFlagsHooks: FlagsServiceHooks = {
modifiedFlags[ApFlagId.THIRD_PARTY_AUTH_PROVIDERS_TO_SHOW_MAP] = {
[ThirdPartyAuthnProviderEnum.GOOGLE]: false,
[ThirdPartyAuthnProviderEnum.GITHUB]: false,
}
},
modifiedFlags[ApFlagId.SHOW_BLOG_GUIDE] = false
modifiedFlags[ApFlagId.SHOW_COMMUNITY_PIECES] = false
modifiedFlags[ApFlagId.SHOW_POWERED_BY_AP] = platform.showPoweredBy
Expand Down
Expand Up @@ -30,8 +30,8 @@ import {
import { buildPaginator } from '../../helper/pagination/build-paginator'
import { projectService } from '../../project/project-service'
import { emailService } from '../helper/email/email-service'
import { getEdition } from '../../helper/secret-helper'
import { projectMembersLimit } from '../billing/limits/members-limit'
import { getEdition } from '../../helper/secret-helper'

const projectMemberRepo = databaseConnection.getRepository(ProjectMemberEntity)

Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/app/flags/flag.service.ts
Expand Up @@ -75,7 +75,8 @@ export const flagService = {
},
{
id: ApFlagId.THIRD_PARTY_AUTH_PROVIDERS_TO_SHOW_MAP,
value: getEdition() === ApEdition.COMMUNITY ? {} : showThirdPartyProvidersMap,
//show only for cloud and hide it for platform users in flags hook
value: getEdition() === ApEdition.CLOUD ? showThirdPartyProvidersMap : {},
created,
updated,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/common/src/lib/service/flag.service.ts
Expand Up @@ -53,7 +53,7 @@ export class FlagService {
return this.getAllFlags().pipe(
map((flags) => {
const firstUser = flags['USER_CREATED'] as boolean;
if (!firstUser && flags['EDITION'] === ApEdition.COMMUNITY) {
if (!firstUser && flags['EDITION'] !== ApEdition.CLOUD) {
return true;
}
return flags['SIGN_UP_ENABLED'] as boolean;
Expand Down
Expand Up @@ -72,7 +72,8 @@

</mat-menu>

<p @fadeInUp class="ap-text-danger ap-text-center" *ngIf="passwordResetActionError">{{ passwordResetActionError }}
<p @fadeInUp class="ap-text-danger ap-text-center ap-mb-2" *ngIf="passwordResetActionError">{{ passwordResetActionError
}}
</p>

<div class="text-center">
Expand Down
@@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable, catchError, tap } from 'rxjs';
import { Observable, catchError, of, tap } from 'rxjs';

import {
containsSpecialCharacter,
Expand Down Expand Up @@ -55,12 +55,13 @@ export class ResetPasswordComponent {
userId,
})
.pipe(
tap(() => this.router.navigate(['/sign-in'])),
catchError((err) => {
this.passwordResetActionError = $localize`Your password reset request has expired, please request a new one`;
this.resetingPassword = false;
console.error(err);
throw err;
}),
tap(() => this.router.navigate(['/sign-in']))
return of(void 0);
})
);
}
}
Expand Down

0 comments on commit 660c50d

Please sign in to comment.