change to firebase auth

This commit is contained in:
2025-02-18 18:05:51 -06:00
parent b9a9b983e9
commit a2e6243e93
34 changed files with 465 additions and 63 deletions

View File

@@ -25,6 +25,7 @@ import { ValidatedLocationComponent } from '../../../components/validated-locati
import { ValidatedQuillComponent } from '../../../components/validated-quill/validated-quill.component';
import { ValidatedSelectComponent } from '../../../components/validated-select/validated-select.component';
import { ValidationMessagesService } from '../../../components/validation-messages.service';
import { AuthService } from '../../../services/auth.service';
import { GeoService } from '../../../services/geo.service';
import { ImageService } from '../../../services/image.service';
import { LoadingService } from '../../../services/loading.service';
@@ -97,6 +98,7 @@ export class AccountComponent {
private subscriptionService: SubscriptionsService,
private datePipe: DatePipe,
private router: Router,
private authService: AuthService,
) {}
async ngOnInit() {
setTimeout(() => {
@@ -105,7 +107,8 @@ export class AccountComponent {
if (this.id) {
this.user = await this.userService.getById(this.id);
} else {
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
const keycloakUser = map2User(token);
const email = keycloakUser.email;
this.user = await this.userService.getByMail(email);

View File

@@ -26,6 +26,7 @@ import { ValidatedQuillComponent } from '../../../components/validated-quill/val
import { ValidatedTextareaComponent } from '../../../components/validated-textarea/validated-textarea.component';
import { ValidationMessagesService } from '../../../components/validation-messages.service';
import { ArrayToStringPipe } from '../../../pipes/array-to-string.pipe';
import { AuthService } from '../../../services/auth.service';
import { GeoService } from '../../../services/geo.service';
import { ImageService } from '../../../services/image.service';
import { LoadingService } from '../../../services/loading.service';
@@ -87,6 +88,7 @@ export class EditBusinessListingComponent {
private route: ActivatedRoute,
private keycloakService: KeycloakService,
private validationMessagesService: ValidationMessagesService,
private authService: AuthService,
) {
this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
@@ -103,7 +105,8 @@ export class EditBusinessListingComponent {
});
}
async ngOnInit() {
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
const keycloakUser = map2User(token);
this.listingUser = await this.userService.getByMail(keycloakUser.email);
if (this.mode === 'edit') {

View File

@@ -30,6 +30,7 @@ import { ValidatedPriceComponent } from '../../../components/validated-price/val
import { ValidatedQuillComponent } from '../../../components/validated-quill/validated-quill.component';
import { ValidationMessagesService } from '../../../components/validation-messages.service';
import { ArrayToStringPipe } from '../../../pipes/array-to-string.pipe';
import { AuthService } from '../../../services/auth.service';
import { GeoService } from '../../../services/geo.service';
import { ImageService } from '../../../services/image.service';
import { LoadingService } from '../../../services/loading.service';
@@ -128,6 +129,7 @@ export class EditCommercialPropertyListingComponent {
private messageService: MessageService,
private viewportRuler: ViewportRuler,
private validationMessagesService: ValidationMessagesService,
private authService: AuthService,
) {
// Abonniere Router-Events, um den aktiven Link zu ermitteln
this.router.events.subscribe(event => {
@@ -145,7 +147,8 @@ export class EditCommercialPropertyListingComponent {
});
}
async ngOnInit() {
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
const keycloakUser = map2User(token);
const email = keycloakUser.email;
this.user = await this.userService.getByMail(email);

View File

@@ -9,6 +9,7 @@ import { ValidatedNgSelectComponent } from '../../../components/validated-ng-sel
import { ValidatedTextareaComponent } from '../../../components/validated-textarea/validated-textarea.component';
import { ValidationMessagesService } from '../../../components/validation-messages.service';
import { AuditService } from '../../../services/audit.service';
import { AuthService } from '../../../services/auth.service';
import { MailService } from '../../../services/mail.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { UserService } from '../../../services/user.service';
@@ -35,11 +36,13 @@ export class EmailUsComponent {
private messageService: MessageService,
public selectOptions: SelectOptionsService,
private auditService: AuditService,
private authService: AuthService,
) {
this.mailinfo = createMailInfo();
}
async ngOnInit() {
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
this.keycloakUser = map2User(token);
if (this.keycloakUser) {
this.user = await this.userService.getByMail(this.keycloakUser.email);

View File

@@ -4,6 +4,7 @@ import { BusinessListing, CommercialPropertyListing } from '../../../../../../bi
import { KeycloakUser } from '../../../../../../bizmatch-server/src/models/main.model';
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
import { AuthService } from '../../../services/auth.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { SharedModule } from '../../../shared/shared/shared.module';
@@ -20,9 +21,16 @@ export class FavoritesComponent {
user: KeycloakUser;
// listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
favorites: Array<BusinessListing | CommercialPropertyListing>;
constructor(public keycloakService: KeycloakService, private listingsService: ListingsService, public selectOptions: SelectOptionsService, private confirmationService: ConfirmationService) {}
constructor(
public keycloakService: KeycloakService,
private listingsService: ListingsService,
public selectOptions: SelectOptionsService,
private confirmationService: ConfirmationService,
private authService: AuthService,
) {}
async ngOnInit() {
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
this.user = map2User(token);
const result = await Promise.all([await this.listingsService.getFavoriteListings('business'), await this.listingsService.getFavoriteListings('commercialProperty')]);
this.favorites = [...result[0], ...result[1]];

View File

@@ -6,6 +6,7 @@ import { ConfirmationComponent } from '../../../components/confirmation/confirma
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
import { MessageComponent } from '../../../components/message/message.component';
import { MessageService } from '../../../components/message/message.service';
import { AuthService } from '../../../services/auth.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { UserService } from '../../../services/user.service';
@@ -32,10 +33,12 @@ export class MyListingComponent {
public selectOptions: SelectOptionsService,
private messageService: MessageService,
private confirmationService: ConfirmationService,
private authService: AuthService,
) {}
async ngOnInit() {
// const keycloakUser = this.userService.getKeycloakUser();
const token = await this.keycloakService.getToken();
// const token = await this.keycloakService.getToken();
const token = await this.authService.getToken();
const keycloakUser = map2User(token);
const email = keycloakUser.email;
this.user = await this.userService.getByMail(email);