Add Verify Email
This commit is contained in:
@@ -8,12 +8,14 @@ import { AboutComponent } from './pages/legal/about/about.component';
|
|||||||
import { SettingsComponent } from './pages/account/settings/settings.component';
|
import { SettingsComponent } from './pages/account/settings/settings.component';
|
||||||
import { LogoutComponent } from './pages/account/logout/logout.component';
|
import { LogoutComponent } from './pages/account/logout/logout.component';
|
||||||
import { ResetPasswordComponent } from './pages/account/resetpassword/resetpassword.component';
|
import { ResetPasswordComponent } from './pages/account/resetpassword/resetpassword.component';
|
||||||
|
import { VerifyEmailComponent } from './pages/account/verifyemail/verifyemail.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
|
|
||||||
// Account stuff
|
// Account stuff
|
||||||
{ path: "account/forgotpassword", component: ForgotPasswordComponent },
|
{ path: "account/forgotpassword", component: ForgotPasswordComponent },
|
||||||
{ path: "account/resetpassword", component: ResetPasswordComponent },
|
{ path: "account/resetpassword", component: ResetPasswordComponent },
|
||||||
|
{ path: "account/verifyemail", component: VerifyEmailComponent },
|
||||||
{ path: "account/login", component: LoginComponent },
|
{ path: "account/login", component: LoginComponent },
|
||||||
{ path: "account/logout", component: LogoutComponent },
|
{ path: "account/logout", component: LogoutComponent },
|
||||||
{ path: "account/register", component: RegisterComponent },
|
{ path: "account/register", component: RegisterComponent },
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<form class="center big-frame background-border" #accountForm="ngForm" (ngSubmit)="onSubmit()">
|
||||||
|
|
||||||
|
<h3>Verifying Email</h3>
|
||||||
|
<h3 style="color: red;">{{ Result }}</h3>
|
||||||
|
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'account-verifyemail',
|
||||||
|
templateUrl: './verifyemail.component.html',
|
||||||
|
imports: [ FormsModule, CommonModule ]
|
||||||
|
})
|
||||||
|
export class VerifyEmailComponent {
|
||||||
|
|
||||||
|
UserName: string = "";
|
||||||
|
Guid: string = "";
|
||||||
|
Result: string = "";
|
||||||
|
|
||||||
|
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) {
|
||||||
|
this.title.setTitle("Verify Email | Mistox");
|
||||||
|
this.route.queryParams.subscribe(params => {
|
||||||
|
this.UserName = params['UserName'] || '';
|
||||||
|
this.Guid = params['Guid'] || '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(ms: number) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
async onSubmit() {
|
||||||
|
// Send to server and wait for response
|
||||||
|
const body = new HttpParams()
|
||||||
|
.set("UserName", this.UserName)
|
||||||
|
.set("EmailToken", this.Guid);
|
||||||
|
const headers = new HttpHeaders({
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
});
|
||||||
|
this.http.post<boolean>( "https://mistox.com/api/account/verifyemail", body, { headers } ).subscribe({
|
||||||
|
next: async (data) => {
|
||||||
|
if (data == true){
|
||||||
|
this.Result = "Verified Email Successfully";
|
||||||
|
}else{
|
||||||
|
this.Result = "Email was not able to be verified please resend email";
|
||||||
|
}
|
||||||
|
await this.sleep(3000);
|
||||||
|
this.router.navigate(["/"]);
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
console.log("HTTP Error Signing In: ", err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user