Skip to content

Commit 5e25480

Browse files
Configuración en firebase para permisos de registro de usuarios finalizada
1 parent d442655 commit 5e25480

File tree

13 files changed

+63
-13
lines changed

13 files changed

+63
-13
lines changed

src/app/app-routing.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { NotFoundComponent } from './components/not-found/not-found.component';
77
import { RegisterComponent } from './components/register/register.component';
88
import { SettingComponent } from './components/setting/setting.component';
99
import { AuthGuard } from './guards/auth.guard';
10+
import { SettingGuard } from './guards/setting.guard';
1011

1112
const routes: Routes = [
1213
{path: "", component: BoardComponent, canActivate: [AuthGuard]},
1314
{path: "login", component: LoginComponent},
14-
{path: "register", component: RegisterComponent},
15+
{path: "register", component: RegisterComponent,canActivate: [SettingGuard]},
1516
{path: "setting", component: SettingComponent,canActivate: [AuthGuard]},
1617
{path: "client/:id", component: ClientEditComponent,canActivate: [AuthGuard]},
1718
{path: "**", component: NotFoundComponent},

src/app/app.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { FormsModule } from '@angular/forms';
2323
import { LoginService } from './services/login.service';
2424
import { AuthGuard } from './guards/auth.guard';
2525
import { SettingService } from './services/setting.service';
26+
import { SettingGuard } from './guards/setting.guard';
2627

2728
@NgModule({
2829
declarations: [
@@ -46,7 +47,7 @@ import { SettingService } from './services/setting.service';
4647
FormsModule,
4748
],
4849
providers: [
49-
ClientService, LoginService, AuthGuard,
50+
ClientService, LoginService, AuthGuard, SettingGuard,
5051
SettingService,
5152
{provide: SETTINGS, useValue:{}}
5253
],

src/app/components/board/board.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<header class="py-2 bg-info text-white">
1+
<header class="py-2 bg-navbar text-white">
22
<div class="container">
33
<div class="row">
44
<div class="col-md-6">

src/app/components/clients/clients.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h4 class="display-4">
9494
>
9595
<div class="modal-dialog modal-lg">
9696
<div class="modal-content">
97-
<div class="modal-header bg-info text-white">
97+
<div class="modal-header bg-navbar text-white">
9898
<h5 class="modal-title">{{ titleModal }}</h5>
9999
<button
100100
type="button"

src/app/components/footer/footer.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<footer class="bg-warning text-white mt-5 pt-5">
1+
<footer class="bg-footer mt-5 pt-5 footer">
22
<div class="container">
33
<div class="row">
44
<div class="col">
55
<p class="lead text-center">
6-
Copyright &copy; Álvaro Barrera
6+
Copyright &copy; <a class="fw-bolder text-wrap text-dark" href="http://alvaro-barrera.github.io/" target="_blank">Álvaro Barrera</a>
77
</p>
88
</div>
99
</div>

src/app/components/header/header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<i class="fas fa-user"></i> Login
3737
</a>
3838
</li>
39-
<li *ngIf="!isLoggedIn" class="nav-item">
39+
<li *ngIf="!isLoggedIn && registerPermission" class="nav-item">
4040
<a routerLink="/register" class="nav-link"
4141
routerLinkActive="router-link-active">
4242
<i class="fas fa-user"></i> Registrarme

src/app/components/header/header.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { LoginService } from 'src/app/services/login.service';
4+
import { SettingService } from 'src/app/services/setting.service';
45

56
@Component({
67
selector: 'app-header',
@@ -10,10 +11,12 @@ import { LoginService } from 'src/app/services/login.service';
1011
export class HeaderComponent implements OnInit {
1112
isLoggedIn: boolean;
1213
loggedInUser: string | null;
14+
registerPermission: boolean | undefined;
1315

1416
constructor(
1517
private loginService: LoginService,
16-
private router: Router
18+
private router: Router,
19+
private settingService: SettingService
1720
) { }
1821

1922
ngOnInit(): void {
@@ -26,6 +29,13 @@ export class HeaderComponent implements OnInit {
2629
this.isLoggedIn = false;
2730
}
2831
});
32+
33+
this.settingService.getsetting()
34+
.subscribe(setting =>{
35+
if (setting != undefined) {
36+
this.registerPermission = setting.registerPermission;
37+
}
38+
})
2939
}
3040
logout(){
3141
this.loginService.logout();

src/app/components/login/login.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<header class="py-2 bg-info text-white">
1+
<header class="py-2 bg-navbar text-white">
22
<div class="container">
33
<div class="col-md-6">
44
<h1><i class="fas fa-user"></i> Login</h1>

src/app/components/register/register.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<header class="py-2 bg-info text-white">
1+
<header class="py-2 bg-navbar text-white">
22
<div class="container">
33
<div class="col-md-6">
44
<h1><i class="fas fa-user"></i> Registrarme</h1>

src/app/components/setting/setting.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<header class="py-2 bg-info text-white">
1+
<header class="py-2 bg-navbar text-white">
22
<div class="container">
33
<div class="col-md-6">
44
<h1><i class="fas fa-user"></i> Configuración</h1>

0 commit comments

Comments
 (0)