This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add page for account activation (#235)
* Add activation page * Center result message * Remove unused imports
- Loading branch information
1 parent
46176e5
commit e707815
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright © Live-Poll 2020-2021. All rights reserved | ||
*/ | ||
|
||
import {NgModule} from '@angular/core'; | ||
import {RouterModule, Routes} from '@angular/router'; | ||
import {ActivationComponent} from './activation.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', component: ActivationComponent }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class ActivationRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
~ Copyright © Live-Poll 2020-2021. All rights reserved | ||
--> | ||
|
||
<div class="page"> | ||
<!-- Spinner --> | ||
<nz-spin *ngIf="loading" nzSimple nzSize="large" class="spinner"></nz-spin> | ||
|
||
<!-- Success message --> | ||
<nz-result | ||
*ngIf="!loading && success" | ||
nzStatus="success" | ||
nzTitle="Successfully activated your account!" | ||
nzSubTitle="You can now continue by logging in to your account. To log in, click below."> | ||
<div nz-result-extra> | ||
<button nz-button nzType="primary" routerLink="/login">Continue to login</button> | ||
<button nz-button routerLink="/">Go to main page</button> | ||
</div> | ||
</nz-result> | ||
|
||
<!-- Error message --> | ||
<nz-result | ||
*ngIf="!loading && !success" | ||
nzStatus="error" | ||
nzTitle="An error occurred while activating your account!" | ||
nzSubTitle="Maybe you're using an expired link or you changed it somehow."> | ||
<div nz-result-extra> | ||
<button nz-button nzType="primary" routerLink="/signup">Retry registration</button> | ||
<button nz-button routerLink="/login">Go to main page</button> | ||
</div> | ||
</nz-result> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*! | ||
/ Copyright © Live-Poll 2020-2021. All rights reserved | ||
/ | ||
.page | ||
display: flex | ||
height: 100vh | ||
align-items: center | ||
justify-content: center | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright © Live-Poll 2020-2021. All rights reserved | ||
*/ | ||
|
||
import {Component, EventEmitter, OnInit} from '@angular/core'; | ||
import {Poll} from '../../model/poll'; | ||
import {User} from '../../model/user'; | ||
import {ActivatedRoute} from '@angular/router'; | ||
import {AccountService} from '../../service/account.service'; | ||
|
||
@Component({ | ||
selector: 'app-home', | ||
templateUrl: './activation.component.html', | ||
styleUrls: ['./activation.component.sass'] | ||
}) | ||
export class ActivationComponent implements OnInit { | ||
|
||
loading = true; | ||
success = true; | ||
|
||
/** | ||
* Initialize component | ||
* | ||
* @param route Active route | ||
* @param accountService Injected AccountService | ||
*/ | ||
constructor( | ||
private route: ActivatedRoute, | ||
private accountService: AccountService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.route.params.subscribe(params => { | ||
this.accountService.confirm(params.token).subscribe((_) => { | ||
this.loading = false; | ||
}, (_) => { | ||
this.success = true; | ||
this.loading = false; | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright © Live-Poll 2020-2021. All rights reserved | ||
*/ | ||
|
||
import {NgModule} from '@angular/core'; | ||
import {ActivationRoutingModule} from './activation-routing.module'; | ||
import {ActivationComponent} from './activation.component'; | ||
import {NzButtonModule} from 'ng-zorro-antd/button'; | ||
import {NzEmptyModule} from 'ng-zorro-antd/empty'; | ||
import {NzBreadCrumbModule} from 'ng-zorro-antd/breadcrumb'; | ||
import {NzLayoutModule} from 'ng-zorro-antd/layout'; | ||
import {NzIconModule} from 'ng-zorro-antd/icon'; | ||
import {CommonModule} from '@angular/common'; | ||
import {ResultEmptyModule} from '../../components/result-empty/result-empty.module'; | ||
import {NzResultModule} from 'ng-zorro-antd/result'; | ||
import {NzSpinModule} from 'ng-zorro-antd/spin'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
ActivationRoutingModule, | ||
NzResultModule, | ||
NzSpinModule, | ||
CommonModule, | ||
NzButtonModule | ||
], | ||
declarations: [ActivationComponent], | ||
exports: [ActivationComponent] | ||
}) | ||
export class ActivationModule { } |