Resend confirmation mail
This commit is contained in:
@@ -69,6 +69,17 @@ export class LoginComponent implements OnInit {
|
||||
this.spinnerService.hideSpinner();
|
||||
}
|
||||
|
||||
openConfirmationMailInfo(email: string) {
|
||||
this.confirmDialog.confirmDialog(
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email"),
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email_d",
|
||||
{ email: email }
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
checkDiscordLogin() {
|
||||
this.route.queryParams.pipe(catchError(err => {
|
||||
this.spinnerService.hideSpinner();
|
||||
@@ -87,19 +98,31 @@ export class LoginComponent implements OnInit {
|
||||
this.spinnerService.hideSpinner();
|
||||
this.router.navigate(["auth", "login"]).then(() => {
|
||||
});
|
||||
this.state = "";
|
||||
this.code = "";
|
||||
this.confirmDialog.confirmDialog(
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email"),
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email_resend"
|
||||
),
|
||||
() => {
|
||||
this.authService.resendConfirmationMailByMail(err.error.email).subscribe(mail => {
|
||||
this.openConfirmationMailInfo(err.error.email);
|
||||
}
|
||||
);
|
||||
|
||||
this.state = "";
|
||||
this.code = "";
|
||||
},
|
||||
() => {
|
||||
this.state = "";
|
||||
this.code = "";
|
||||
}
|
||||
);
|
||||
|
||||
return throwError(() => err);
|
||||
})).subscribe(token => {
|
||||
if (token.firstLogin) {
|
||||
this.confirmDialog.confirmDialog(
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email"),
|
||||
this.translate.instant(
|
||||
"auth.login.message.confirm_email_d",
|
||||
{ email: this.authService.getEMailFromDecodedToken(this.authService.getDecodedToken(token)) }
|
||||
)
|
||||
);
|
||||
this.openConfirmationMailInfo(this.authService.getEMailFromDecodedToken(this.authService.getDecodedToken(token)) ?? "");
|
||||
}
|
||||
|
||||
this.authService.saveToken(token);
|
||||
|
@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { JwtHelperService } from "@auth0/angular-jwt";
|
||||
import { BehaviorSubject, firstValueFrom, Observable, Subject, Subscription, throwError } from "rxjs";
|
||||
import { BehaviorSubject, firstValueFrom, Observable, Subscription, throwError } from "rxjs";
|
||||
import { catchError } from "rxjs/operators";
|
||||
import { AdminUpdateUserDTO } from "src/app/models/auth/admin-update-user.dto";
|
||||
import { AuthRoles } from "src/app/models/auth/auth-roles.enum";
|
||||
@@ -16,7 +16,6 @@ import { GetFilteredAuthUsersResultDTO } from "src/app/models/selection/auth-use
|
||||
import { SettingsService } from "../settings/settings.service";
|
||||
import { SpinnerService } from "../spinner/spinner.service";
|
||||
import { DiscordAuthURL } from "../../models/auth/discord-auth-url.dto";
|
||||
import { OAuthDTO } from "../../models/auth/oauth.dto";
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root"
|
||||
@@ -108,6 +107,14 @@ export class AuthService {
|
||||
});
|
||||
}
|
||||
|
||||
resendConfirmationMailByMail(email: string): Observable<unknown> {
|
||||
return this.http.post(`${this.appsettings.getApiURL()}/api/auth/resend-confirmation-email-by-mail/${email}`, {
|
||||
headers: new HttpHeaders({
|
||||
"Content-Type": "application/json"
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
getEMailFromforgotPasswordId(id: string): Observable<EMailStringDTO> {
|
||||
return this.http.post<EMailStringDTO>(`${this.appsettings.getApiURL()}/api/auth/confirm-forgot-password/${id}`, {
|
||||
headers: new HttpHeaders({
|
||||
@@ -173,23 +180,6 @@ export class AuthService {
|
||||
});
|
||||
}
|
||||
|
||||
// /api/auth/discord/register?code=
|
||||
discordRegister(oAuthDTO: OAuthDTO) {
|
||||
return this.http.post(`${this.appsettings.getApiURL()}/api/auth/discord/register`, oAuthDTO, {
|
||||
headers: new HttpHeaders({
|
||||
"Content-Type": "application/json"
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// discordGetUser(code: string, state: string) {
|
||||
// return this.http.get<AuthUserDTO>(`${this.appsettings.getApiURL()}/api/auth/discord/get-user?code=${code}&state=${state}`, {
|
||||
// headers: new HttpHeaders({
|
||||
// 'Content-Type': 'application/json'
|
||||
// })
|
||||
// });
|
||||
// }
|
||||
|
||||
/* utils */
|
||||
saveToken(token: TokenDTO): void {
|
||||
localStorage.setItem("jwt", token.token);
|
||||
|
@@ -93,7 +93,8 @@
|
||||
"login_with_discord": "Mit Discord einloggen",
|
||||
"message": {
|
||||
"confirm_email": "E-Mail Bestätigen",
|
||||
"confirm_email_d": "Sie müssen die E-Mail {{email}} Bestätigen, in dem Sie den Link öffnen, welchen wir Ihnen zugesendet haben."
|
||||
"confirm_email_d": "Sie müssen die E-Mail {{email}} Bestätigen, in dem Sie den Link öffnen, welchen wir Ihnen zugesendet haben.",
|
||||
"confirm_email_resend": "Sollen wir die Bestätigungsmail neu verschicken?"
|
||||
},
|
||||
"password": "Passwort",
|
||||
"password_required": "Passwort benötigt",
|
||||
|
@@ -93,7 +93,8 @@
|
||||
"login_with_discord": "Login with discord",
|
||||
"message": {
|
||||
"confirm_email": "Confirm E-Mail",
|
||||
"confirm_email_d": "You have to confirm your email {{email}} Please confirm your account through the link in the email."
|
||||
"confirm_email_d": "You have to confirm your email {{email}} Please confirm your account through the link in the email.",
|
||||
"confirm_email_resend": "Should we resend the confirmation email?"
|
||||
},
|
||||
"password": "Password",
|
||||
"password_required": "Passwort required",
|
||||
|
Reference in New Issue
Block a user