abacritt / angularx-social-login

Social login and authentication module for Angular 17
630 stars 388 forks source link

How to remove recommend login with google, when I'm logged in with a regular account #742

Open GabrielMJin opened 6 months ago

GabrielMJin commented 6 months ago

Hi, guys. How do I identify that I am logged in with an account other than a social network, and do not recommend logging in with Google?

example: when i logged with my email, the library does not identify that I logged in because I don't use the library to login with my email

lwestfall commented 6 months ago

FYI this probably should be in a discussion or stackoverflow - not an issue.

There's a lot of ways to do this, just wrap your asl-google-signin-button directive in a container with conditional logic checking some signed in state in your component, or put it in a template that's rendered as an else block, e.g.:

<div *ngIf="signedIn; else notLoggedIn">
    Hi, {{ (user.firstName }}!
</div>
<ng-template #notLoggedIn>
  <asl-google-signin-button
    type="standard"
    size="medium"
    theme="filled_blue"
    logo_alignment="center">
  </asl-google-signin-button>
</ng-template>

See https://angular.io/api/common/NgIf