Skip to content

Commit

Permalink
put github signin on feature flag (#1177)
Browse files Browse the repository at this point in the history
* put github signin on feature flag

* fix test
  • Loading branch information
ebrehault authored Dec 8, 2023
1 parent 59002a2 commit 1307088
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 5 additions & 3 deletions libs/user/src/lib/signup/signup.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ <h1>{{ 'signup.title' | translate }}</h1>
<stf-sso-button
provider="google"
signup></stf-sso-button>
<stf-sso-button
provider="github"
signup></stf-sso-button>
@if (isGitHubEnabled | async) {
<stf-sso-button
provider="github"
signup></stf-sso-button>
}
</div>

<p class="existing-account">
Expand Down
7 changes: 5 additions & 2 deletions libs/user/src/lib/signup/signup.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { ReactiveFormsModule } from '@angular/forms';
import { UserContainerComponent } from '../user-container';
import { RouterTestingModule } from '@angular/router/testing';
import { ReCaptchaV3Service } from 'ngx-captcha';
import { BackendConfigurationService, LoginService, SignupResponse } from '@flaps/core';
import { BehaviorSubject } from 'rxjs';
import { BackendConfigurationService, FeatureFlagService, LoginService, SignupResponse } from '@flaps/core';
import { BehaviorSubject, of } from 'rxjs';
import { Router } from '@angular/router';
import { SisPasswordInputModule } from '@nuclia/sistema';
import { Component } from '@angular/core';
Expand Down Expand Up @@ -46,6 +46,9 @@ describe('SignupComponent', () => {
MockProvider(LoginService, {
signup: jest.fn(() => signupResponse.asObservable()),
}),
MockProvider(FeatureFlagService, {
isFeatureEnabled: jest.fn(() => of(true)),
}),
MockProvider(BackendConfigurationService, {
getRecaptchaKey: () => 'fake',
}),
Expand Down
4 changes: 3 additions & 1 deletion libs/user/src/lib/signup/signup.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ReCaptchaV3Service } from 'ngx-captcha';
import { BackendConfigurationService, LoginService } from '@flaps/core';
import { BackendConfigurationService, FeatureFlagService, LoginService } from '@flaps/core';
import { Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { IErrorMessages } from '@guillotinaweb/pastanaga-angular';
Expand Down Expand Up @@ -41,6 +41,7 @@ export class SignupComponent implements OnInit {
get emailControl() {
return this.signupForm.controls['email'];
}
isGitHubEnabled = this.featureFlag.isFeatureEnabled('github-signin');

constructor(
private router: Router,
Expand All @@ -49,6 +50,7 @@ export class SignupComponent implements OnInit {
private loginService: LoginService,
public config: BackendConfigurationService,
private cdr: ChangeDetectorRef,
private featureFlag: FeatureFlagService,
) {}

ngOnInit(): void {
Expand Down

0 comments on commit 1307088

Please sign in to comment.