Skip to content

Commit

Permalink
Fix bug | Login failed when incorrect password
Browse files Browse the repository at this point in the history
  • Loading branch information
LuongXuanNhat committed Jan 18, 2024
1 parent e5110fb commit 081dc14
Show file tree
Hide file tree
Showing 36 changed files with 177 additions and 134 deletions.
57 changes: 43 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
# VietNamHistory
# Introduce
The application for learning and studying the history of Vietnam includes the following main components:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.1.0.
**User Interface**: The application's user interface is designed to be friendly and easy to use, helping users to easily search for and study the history of Vietnam. Users can access the application through a mobile app or a dedicated website.

## Development server
**Historical Database**: The application utilizes a database to store information about the history of Vietnam, including historical events, historical figures, historical landmarks, historical artifacts, etc. This database is regularly updated to ensure the accuracy and completeness of the information.

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
**Features**: The application provides the following features to help users learn and study the history of Vietnam: Search for information, explore history, study historical events, etc.

## Code scaffolding
The learning and studying history application of Vietnam brings many benefits to users, including:

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
**Convenience**: Users can easily search for and study the history of Vietnam anytime, anywhere through mobile devices.

## Build
**Effectiveness**: The application provides various forms of information content that is suitable for the needs and learning abilities of users. The information is presented in a vivid and engaging manner, making it easy for users to remember and understand.

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
The learning and studying history application of Vietnam is a useful information technology solution, helping users to have a better learning experience of the history of Vietnam.
# Getting Started
Using tech | Angular v16, Bootstrap, Material, CKeditor, ...

## Running unit tests
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Installation
**Step 1**: Clone repository to your computer by git with comand

## Running end-to-end tests
```bash
git clone https://github.com/LuongXuanNhat/VietNamHistory_FEweb.git
```
**Step 2**: Use the [Node package manager](https://www.npmjs.com/):

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
```bash
npm install
```
**Step 3**: To run progam , type command:
```bash
ng serve -o
```
## Note

## Further help
> Don't forget to clone the backend [here](https://github.com/LuongXuanNhat/VietNamHistory_BE)
```
// src\app\service\auth.service.ts
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
apiurl = 'https://localhost:7138';
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

## Watch the demo video [here](https://www.youtube.com/watch?v=NqTf46UVhHc)
If you find it interesting and useful, please give me a star 🌟, thank you very much 🍀

## License

[MIT](https://choosealicense.com/licenses/mit/)
17 changes: 8 additions & 9 deletions docs/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/styles.0eddc67b36476482.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/styles.3be4ef6e3b3c586e.css

This file was deleted.

4 changes: 2 additions & 2 deletions src/app/account/account/login/login.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div style="width: 100%; margin-top: 100px;" class="form-register" >
<mat-card class="form-register font">
<mat-card-header>
<h5>Đăng nhập</h5>
<h1 class="fw-6">Đăng nhập</h1>
</mat-card-header>
<mat-card-subtitle>
<span>admin@gmail.com</span>
<span>admin&#64;gmail.com</span>
</mat-card-subtitle>
<mat-card-content>
<form [formGroup]="loginform" (ngSubmit)="proceedlogin()">
Expand Down
2 changes: 1 addition & 1 deletion src/app/account/account/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class LoginComponent {
if(this.loginform.valid){
this.service.Login(this.loginform.value).subscribe( (res: any) => {
const resultObj = res.resultObj;
this.sessionService.setToken(resultObj);
if(res.isSuccessed){
this.sessionService.setToken(resultObj);
const decodedToken = this.jwtHelper.decodeToken(res.resultObj);
const email = decodedToken['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'];
const role = decodedToken['http://schemas.microsoft.com/ws/2008/06/identity/claims/role'];
Expand Down
5 changes: 1 addition & 4 deletions src/app/account/account/register/register.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<div style="width: 100%; margin-top: 100px;" class="form-register" >
<mat-card class="form-register font" >
<mat-card-header>
<h5>Bắt đầu thôi 🚀</h5>
<h1>Đăng ký tài khoản 🚀</h1>
</mat-card-header>
<mat-card-subtitle>
<p>Đăng ký tài khoản</p>
</mat-card-subtitle>
<mat-card-content >
<form class="font " [formGroup]="registerform" (ngSubmit)="proceedregisteration()">
<mat-form-field class="example-full-width">
Expand Down
2 changes: 1 addition & 1 deletion src/app/account/introduce/introduce.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h5 class="pb">Cài đặt tài khoản</h5>
<label for="fileInput" class="po-ab custom-file-upload btn-image">
<input type="file" id="fileInput" (change)="onFileSelected($event)">
<mat-icon>add_a_photo</mat-icon>
</label>
</label>
</div>
<button type="submit" style="display: none;"></button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class UpdateuserinforComponent implements OnInit {

userform = this.builder.group({
Email: this.builder.control('', Validators.required),
Fullname: this.builder.control('') ,
Fullname: this.builder.control('', Validators.required),
Sex: this.builder.control(''),
Gender: this.builder.control(0),
DateOfBirth: this.builder.control(new Date()),
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const routes: Routes = [
{path: 'login', component:LoginComponent},
{path: 'discover', component:DiscoverComponent},
{path: 'searchposts', component: SearchpageComponent},
{path: 'discover/:postId', component: PostdetailComponent},
{path: 'discover/:postId', component: PostdetailComponent},
{
path: 'account',
component: AccountComponent, canActivate: [AuthGuard] ,
Expand Down
10 changes: 3 additions & 7 deletions src/app/course/course.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
.ie body {
filter: dropshadow(color=#000000, offx=0, offy=1);
}
h1 {
font-size:50px !important;
letter-spacing:-2px;
line-height:40px;
text-align:center;
}

.ie h1 {
filter: dropshadow(color=#000000, offx=0, offy=3);
padding-bottom:12px;
Expand Down Expand Up @@ -62,7 +57,8 @@ border-radius: 180px;
.logo h1{
color:#0f66b1;
font-weight:600;

margin-top: 32px;
margin-bottom: 16px;
}
.logo img {
width: 80px;
Expand Down
21 changes: 6 additions & 15 deletions src/app/course/course.component.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<!--
Theme by: WebThemez.com
Note: Please use our back link in your site (webthemez.com)
-->
<!--[if lt IE 7 ]> <html lang="en" class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="ie ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="ie ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="ie ie9"> <![endif]-->


<section class="main">
<div id="Content" class="wrapper topSection">
<div id="Header">
<div class="wrapper">
<div class="logo">
<h1>
<img src="assets/Icon/logotyls.png" />
Tôi Yêu Lịch Sử
<h3 class="flex-center font ">
💥 Sắp ra mắt 💥
</h3>
<img src="assets/Icon/logotyls.png" />
<h1 style="text-align: center;">
Khóa học | Tôi Yêu Lịch Sử
</h1>
<h3 class="flex-center font ">
💥 Sắp ra mắt 💥
</h3>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/discover/discover.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="mt-60">
<div class="plr-200">
<div class="flex-center font">

<div class="flex-center-sb">
<h1 class="card-title">Khám phá lịch sử</h1>
<div class="search-container">
<input type="text" matInput [(ngModel)]="keyWord" placeholder="Tìm kiếm" class="input-search font" (keyup.enter)="search()">
<button class="btn-search" (click)="search()">
Expand Down
8 changes: 4 additions & 4 deletions src/app/discover/postdetail/postdetail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
</div>
</div>
<div>
<h5 class="font">{{postData?.title}}</h5>
<h1 class="font fw-6">{{postData?.title}}</h1>
<div>
<div class="font" [innerHTML]="postData?.content" style="margin: 16px 0px;"></div>
<p class="font" [innerHTML]="postData?.content" style="margin: 16px 0px;"></p>
<div class="flex-center-sb">
<div ><strong>Lượt xem: {{postData?.viewNumber}}</strong> </div>
<div class="flex-center-h cursor-d" matTooltip="{{postData?.updatedAt ? 'Ngày cập nhập':'Ngày tạo'}}" matTooltipPosition="left">
Expand All @@ -117,8 +117,8 @@ <h5 class="font">{{postData?.title}}</h5>
<p style="margin-top: 4px;"><strong>Các bài viết liên quan</strong></p>
</div>
<div>
<div *ngFor="let post of posts" style="display:flex;">
<a class="small-post-card plr-12 font pt pb" (click)="postDetail(post)" >
<div *ngFor="let post of posts" class="dis-flex">
<a class="small-post-card plr-12 font pt pb " (click)="postDetail(post)" >
<img src="{{post.image}}" alt="" class="post-img" loading="lazy">
<div style="display: inline-block;" class="pl">
<span class="text-3-line">{{post.title}}</span>
Expand Down
20 changes: 11 additions & 9 deletions src/app/document/document.component.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<div class="plr-200 mt-60 h-page">
<div>
<div class="flex-center">

<div class="search-container">
<input type="text" matInput [(ngModel)]="keyWord" placeholder="Tìm kiếm" class="input-search font" (keyup.enter)="search()">
<button class="btn-search" (click)="search()">
<mat-icon matSuffix matRipple class="mr btn-search-icon">search</mat-icon>
</button>
</div>
<div class="flex-center-sb">
<h1 class="card-title">Tài liệu lịch sử</h1>
<div>
<div class="po-ab" *ngIf="countResult; " style="right: 24px;font-size: 12px; font-weight: 500;"><i><strong>{{countResult}}</strong> tài liệu được tìm thấy</i></div>
<div class="search-container">
<input type="text" matInput [(ngModel)]="keyWord" placeholder="Tìm kiếm" class="input-search font" (keyup.enter)="search()">
<button class="btn-search" (click)="search()">
<mat-icon matSuffix matRipple class="mr btn-search-icon">search</mat-icon>
</button>
</div>
<div>
<div class="po-ab" *ngIf="countResult; " style="right: 24px;font-size: 12px; font-weight: 500;"><i><strong>{{countResult}}</strong> tài liệu được tìm thấy</i></div>
</div>
</div>
</div>
<div class="mt-1">
Expand Down
4 changes: 2 additions & 2 deletions src/app/document/documentdetail/documentdetail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<div class="mt-60 plr-300 h-page">

<div>
<span style="font-size: 20px;" class="pt-1 pb-1 dis-block">📒 {{document.title}}</span>
<span class="use-space">{{ document.description }}</span>
<h1 class="pt-1 pb-1 dis-block fw-6">📒 {{document.title}}</h1>
<p class="use-space">{{ document.description }}</p>
<div class="dis-flex mb mt-1" style="float: right;">
<div class="flex-center-h" *ngIf="document.type === 'pdf'; else docx" matTooltip="Tải tài liệu" matTooltipPosition="left">
<a (click)="downloadPdfFile()">
Expand Down
2 changes: 1 addition & 1 deletion src/app/exam/exam.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ option {
}
.header-banner {
margin-top: 16px;
height: 300px;
height: fit-content;
width: 100%;
text-align: center;
}
Expand Down
23 changes: 13 additions & 10 deletions src/app/exam/exam.component.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<div class="plr-200 mt-60 h-page">
<div>
<div class="flex-center">
<div style="left: 20px;" class="po-ab">
<div class="flex-center-sb">
<h1 class="card-title">Trắc nghiệm lịch sử</h1>
<!-- <div style="left: 20px;" class="po-ab">
<label for="dropdown" class="mr">Sắp xếp</label>
<select id="dropdown" name="dropdown" style="height: 30px; border-radius: 2px; border: 1px solid #ccc;">
<option value="1">Mới nhất</option>
<option value="2">Nhiều lượt thi nhất</option>
<option value="3">Đã làm</option>
</select>
</div>
<div class="search-container">
<input type="text" matInput [(ngModel)]="keyWord" placeholder="Tìm kiếm" class="input-search font" (keyup.enter)="search()">
<button class="btn-search" (click)="search()">
<mat-icon matSuffix matRipple class="mr btn-search-icon">search</mat-icon>
</button>
</div>
</div> -->
<div>
<div class="po-ab" *ngIf="countResult; " style="right: 24px;font-size: 12px; font-weight: 500;"><i><strong>{{countResult}}</strong> bài tập được tìm thấy</i></div>
<div class="search-container">
<input type="text" matInput [(ngModel)]="keyWord" placeholder="Tìm kiếm" class="input-search font" (keyup.enter)="search()">
<button class="btn-search" (click)="search()">
<mat-icon matSuffix matRipple class="mr btn-search-icon">search</mat-icon>
</button>
</div>
<div>
<div class="po-ab" *ngIf="countResult > 0; " style="right: 24px;font-size: 12px; font-weight: 500;"><i><strong>{{countResult}}</strong> bài tập được tìm thấy</i></div>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/app/exam/exam.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ export class ExamComponent {
if(data.isSuccessed){
this.session.setKeyWordDocument(this.keyWord ?? '');
this.exams = data.resultObj;
this.countResult = this.exams.length;
this.updatePagedExams();
}
}
)
} else {
this.getExams();
this.countResult = 0;
}
}
getExams() {
Expand Down
1 change: 0 additions & 1 deletion src/app/forum/forum-foryou/forum-foryou.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
cursor: pointer;
padding: 16px 12px;
box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
margin: 8px 0px;
}
.question-card:hover {
box-shadow: rgba(17, 17, 26, 0.05) 0px 4px 16px, rgba(17, 17, 26, 0.05) 0px 8px 32px;
Expand Down
4 changes: 4 additions & 0 deletions src/app/forum/forum.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.menu-forum {
width: fit-content;
background-color: white;
}
6 changes: 4 additions & 2 deletions src/app/forum/forum.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="mt-60">
<div>
<div style="width: 374px;" class="fixed-menu dis-flex" appScroll>

<div class="fixed-menu dis-flex menu-forum" appScroll>
<h1 class="card-title">Diễn đàn lịch sử</h1>
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
<a *ngFor="let cate of category" mat-tab-link class="pl-1"
[routerLink]="cate.url" routerLinkActive #rla="routerLinkActive"
Expand All @@ -16,7 +18,7 @@
<mat-icon matSuffix matRipple class="mr btn-search-icon">search</mat-icon>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="plr-200" >
Expand Down
4 changes: 2 additions & 2 deletions src/app/forum/question/question.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
</div>
</div>
<div>
<p class="font fs-20"> <strong>{{question?.title}}</strong></p>
<h1 class="fs-20 fw-6">{{question?.title}}</h1>
<div>
<div class="font content-question mt-1 mb-1" [innerHTML]="question?.content" style="overflow: auto;"></div>
<p class="font content-question mt-1 mb-1" [innerHTML]="question?.content" style="overflow: auto;"></p>
<span class="flex-center-sb">
<div ><strong>Lượt xem: {{question?.viewNumber}}</strong></div>
<div class="flex-center-h cursor-d" matTooltip="{{question?.updatedAt == null ? 'Đã tạo' : 'Đã sửa'}}" matTooltipPosition="right">
Expand Down
10 changes: 5 additions & 5 deletions src/app/forum/searchquestion/searchquestion.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@
</div>
<div >
<div *ngFor="let question of questionNews" class="">
<div style="z-index: 1; margin-left: -3em;" class="po-re">
<button matTooltip="Lưu vào xem sau" mat-mini-fab *ngIf="!question.isSaved; else saved" (click)="IsSave(question, $event)" class="btn-interact po-ab" style="margin-top: 16px; margin-left: 12px;background-color: #00000073 !important;">
<div style="z-index: 1;margin-left: -4em;" class="po-re">
<button matTooltip="Lưu vào xem sau" mat-mini-fab *ngIf="!question.isSaved; else saved" (click)="IsSave(question, $event)" class="btn-interact po-ab" style="margin-top: 16px;background-color: #00000073 !important;">
<mat-icon class="material-symbols-outlined text-white">
bookmark_add
</mat-icon>
</button>
<ng-template #saved >
<button mat-mini-fab (click)="IsSave(question, $event)" class="selected btn-interact po-ab" style="margin-top: 16px; margin-left: 12px;">
<button mat-mini-fab (click)="IsSave(question, $event)" class="selected btn-interact po-ab" style="margin-top: 16px;">
<mat-icon color="primary" class="material-symbols-outlined selected-icon text-white">
bookmark_added
</mat-icon>
</button>
</ng-template>
</div>
<a (click)="questionDetail(question)" >
<div class="question-card">
<h6 class="text-3-line">🔖<strong >{{question.title}}</strong></h6>
<div class="question-card" style="margin-top: 16px; ">
<h2 class="text-3-line">🔖<strong >{{question.title}}</strong></h2>
<div class="flex-center-h">
<div class="flex-center-h plr-12">
<span class="material-symbols-outlined pr">
Expand Down
Loading

0 comments on commit 081dc14

Please sign in to comment.