-
-
-
-
+
+
-
-
-
-
-
-
- Already have an Account?
Login
+
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+ Already have an Account?
+
Login
+
+
diff --git a/src/UI/src/app/modules/auth/pages/register/register.component.scss b/src/UI/src/app/modules/auth/pages/register/register.component.scss
index e69de29..614edb7 100644
--- a/src/UI/src/app/modules/auth/pages/register/register.component.scss
+++ b/src/UI/src/app/modules/auth/pages/register/register.component.scss
@@ -0,0 +1,17 @@
+.is__invalid-input {
+ border-color: #e11d48;
+ }
+
+ .is__invalid-error {
+ color: #e11d48;
+ @apply px-1 pt-1 text-xs;
+ }
+
+ .input-psw{
+ border-color: #d1d5db;
+ background: #f9fafb ;
+ }
+
+ .custom:checked{
+ color: #22c55e;
+ }
diff --git a/src/UI/src/app/modules/auth/pages/register/register.component.ts b/src/UI/src/app/modules/auth/pages/register/register.component.ts
index 69f75f1..f47c05f 100644
--- a/src/UI/src/app/modules/auth/pages/register/register.component.ts
+++ b/src/UI/src/app/modules/auth/pages/register/register.component.ts
@@ -12,6 +12,8 @@ import { HttpClientModule } from '@angular/common/http';
import { AuthService } from 'src/app/core/auth/service/auth.service';
import { AlertServiceService } from 'src/app/shared/service/alert-service.service';
import { ToastrService } from 'ngx-toastr';
+import { NgIcon, provideIcons } from '@ng-icons/core';
+import { heroEye, heroEyeSlash } from '@ng-icons/heroicons/outline';
@Component({
selector: 'app-register',
@@ -23,14 +25,18 @@ import { ToastrService } from 'ngx-toastr';
HttpClientModule,
RouterLink,
ReactiveFormsModule,
+ NgIcon,
],
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss'],
+ viewProviders: [provideIcons({ heroEye, heroEyeSlash })],
})
export class RegisterComponent implements OnInit {
form!: FormGroup;
submitted = false;
passwordTextType!: boolean;
+ checked: boolean = false;
+ passwordStrength = 0;
constructor(
private readonly _formBuilder: FormBuilder,
@@ -43,6 +49,8 @@ export class RegisterComponent implements OnInit {
this.form = this._formBuilder.group({
email: ['', [Validators.required, Validators.email]],
password: ['', Validators.required],
+ confirmPassword: ['', Validators.required],
+
});
}
@@ -50,20 +58,35 @@ export class RegisterComponent implements OnInit {
return this.form.controls;
}
+ togglePasswordTextType() {
+ this.passwordTextType = !this.passwordTextType;
+ }
+
onRegister() {
- const { email, password } = this.form.value;
+ this.submitted = true;
+
+ const { email, password, confirmPassword } = this.form.value;
if (this.form.invalid) {
return;
}
+ if (password != confirmPassword) {
+ this.toastr.error('Password and confirm password do not match');
+ return;
+ }
+
+ if (!this.checked) {
+ this.toastr.error('Please accept the terms and conditions');
+ return;
+ }
+
this.authService.register(email, password).subscribe({
next: (response: any) => {
if (response.succeeded) {
this.toastr.success('Registration successful. Please login');
this._router.navigate(['/auth/login']);
} else {
- // Handle registration failure
if (response.errors && response.errors.length > 0) {
const errorMessage = response.errors[0];
this.toastr.error(errorMessage);
@@ -77,4 +100,38 @@ export class RegisterComponent implements OnInit {
},
});
}
+
+ updateChecked(event: Event): void {
+ this.checked = (event.target as HTMLInputElement).checked;
+ }
+
+ updatePasswordStrength(password: any): void {
+ this.passwordStrength = this.calculatePasswordStrength(password.value);
+ }
+
+ calculatePasswordStrength(password: string): number {
+ // Initialize score
+ let score = 0;
+
+ // Check for minimum length
+ if (password.length >= 8) {
+ score++;
+ }
+ // Check for presence of uppercase letters
+ if (/[A-Z]/.test(password)) {
+ score++;
+ }
+
+ // Check for presence of numbers
+ if (/\d/.test(password)) {
+ score++;
+ }
+
+ // Check for presence of symbols
+ if (/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
+ score++;
+ }
+
+ return score;
+ }
}
diff --git a/src/UI/src/app/modules/management/pages/user-courses/courses.component.html b/src/UI/src/app/modules/management/pages/user-courses/courses.component.html
index 5f55cc1..f2e50c9 100644
--- a/src/UI/src/app/modules/management/pages/user-courses/courses.component.html
+++ b/src/UI/src/app/modules/management/pages/user-courses/courses.component.html
@@ -15,6 +15,7 @@
>
+
diff --git a/src/UI/src/assets/images/ed.svg b/src/UI/src/assets/images/ed.svg
index 74f96dd..c0fe796 100644
--- a/src/UI/src/assets/images/ed.svg
+++ b/src/UI/src/assets/images/ed.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/UI/src/styles.scss b/src/UI/src/styles.scss
index 8070f2c..9d6be5c 100755
--- a/src/UI/src/styles.scss
+++ b/src/UI/src/styles.scss
@@ -9,9 +9,11 @@
-.input:focus {
- outline: none !important;
-}
+// needed for cmd k
+
+// .input:focus {
+// outline: none !important;
+// }
.dark .ng-select.custom .ng-select-container {
background-color: #070e16 !important;
@@ -56,8 +58,6 @@
}
:root {
- --font-sans: 'Inter', --apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
- Droid Sans, Helvetica Neue, sans-serif;
--app-bg: var(--gray1);
--cmdk-shadow: 0 16px 70px rgb(0 0 0 / 20%);
--cmdk-list-height: 300px;
@@ -106,7 +106,6 @@
}
.dark {
- --app-bg: var(--gray1);
--lowContrast: #000000;
--highContrast: #ffffff;
@@ -170,7 +169,7 @@
@apply w-full rounded-md border border-gray-300 px-3 py-3 text-xs placeholder-gray-400 focus:z-10 focus:border-primary-500 focus:outline-none focus:ring-primary-500 dark:border-night-500 dark:bg-night-700 dark:text-night-400 dark:placeholder-night-200;
}
- [type='checkbox'],
+
[type='radio'] {
@apply h-4 w-4 rounded border-gray-300 bg-gray-100 text-green-600 focus:ring-2 focus:ring-green-500 dark:border-night-600 dark:bg-night-700 dark:ring-offset-night-800 dark:focus:ring-green-600;
}