verfication email & new auth domain
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { lastValueFrom, Observable } from 'rxjs';
|
||||
import { ShareByEMail } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { ErrorResponse, MailInfo } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
@@ -18,4 +18,32 @@ export class MailService {
|
||||
async mailToFriend(shareByEMail: ShareByEMail): Promise<void | ErrorResponse> {
|
||||
return await lastValueFrom(this.http.post(`${this.apiBaseUrl}/bizmatch/mail/send2Friend`, shareByEMail));
|
||||
}
|
||||
/**
|
||||
* Sendet eine E-Mail-Verifizierung an die angegebene E-Mail-Adresse
|
||||
* @param email Die E-Mail-Adresse des Benutzers
|
||||
* @param redirectConfig Konfiguration für die Weiterleitung nach Verifizierung
|
||||
* @returns Observable mit der API-Antwort
|
||||
*/
|
||||
sendVerificationEmail(
|
||||
email: string,
|
||||
redirectConfig?: {
|
||||
protocol?: string,
|
||||
hostname?: string,
|
||||
port?: number
|
||||
}
|
||||
): Observable<any> {
|
||||
// Extrahiere aktuelle URL-Informationen, wenn nicht explizit angegeben
|
||||
const currentUrl = new URL(window.location.href);
|
||||
|
||||
const config = {
|
||||
protocol: redirectConfig?.protocol || currentUrl.protocol.replace(':', ''),
|
||||
hostname: redirectConfig?.hostname || currentUrl.hostname,
|
||||
port: redirectConfig?.port || (currentUrl.port ? parseInt(currentUrl.port) : undefined)
|
||||
};
|
||||
|
||||
return this.http.post(`${this.apiBaseUrl}/bizmatch/mail/verify-email`, {
|
||||
email,
|
||||
redirectConfig: config
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user