Feature: Added Login / Register Feature #3

Merged
igorpropisnov merged 26 commits from feature/register-view into main 2024-05-21 21:24:11 +02:00
9 changed files with 52 additions and 8 deletions
Showing only changes of commit 84afd4e4e8 - Show all commits

View File

@ -1,7 +1,7 @@
{ {
"root": true, "root": true,
"ignorePatterns": ["projects/**/*"], "ignorePatterns": ["projects/**/*"],
"plugins": ["import", "prettier", "@stylistic/eslint-plugin-ts", "sort-class-members"], "plugins": ["import", "prettier", "@stylistic/eslint-plugin-ts", "sort-class-members", "unused-imports"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
@ -64,9 +64,24 @@
// "@stylistic/ts/template-curly-spacing": ["error"], // "@stylistic/ts/template-curly-spacing": ["error"],
// "@stylistic/ts/template-tag-spacing": ["error"], // "@stylistic/ts/template-tag-spacing": ["error"],
// "@stylistic/ts/wrap-regex": ["error"], // "@stylistic/ts/wrap-regex": ["error"],
"no-console": ["warn", { "allow": ["warn", "error"] }],
"no-debugger": "error",
"no-var": ["error"], "no-var": ["error"],
"no-unused-vars": "off", "eqeqeq": ["error", "always"],
"no-eval": "error",
"prefer-const": ["error", { "destructuring": "all", "ignoreReadBeforeAssign": true }],
"prettier/prettier": ["error", { "printWidth": 80 }], "prettier/prettier": ["error", { "printWidth": 80 }],
"no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"@angular-eslint/directive-selector": [ "@angular-eslint/directive-selector": [
"error", "error",
{ {

View File

@ -54,6 +54,7 @@
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sort-class-members": "^1.20.0", "eslint-plugin-sort-class-members": "^1.20.0",
"eslint-plugin-unused-imports": "^3.2.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-preset-angular": "^14.0.3", "jest-preset-angular": "^14.0.3",
"prettier": "3.2.5", "prettier": "3.2.5",

View File

@ -103,6 +103,9 @@ devDependencies:
eslint-plugin-sort-class-members: eslint-plugin-sort-class-members:
specifier: ^1.20.0 specifier: ^1.20.0
version: 1.20.0(eslint@8.57.0) version: 1.20.0(eslint@8.57.0)
eslint-plugin-unused-imports:
specifier: ^3.2.0
version: 3.2.0(@typescript-eslint/eslint-plugin@6.19.0)(eslint@8.57.0)
jest: jest:
specifier: ^29.7.0 specifier: ^29.7.0
version: 29.7.0 version: 29.7.0
@ -5434,6 +5437,26 @@ packages:
eslint: 8.57.0 eslint: 8.57.0
dev: true dev: true
/eslint-plugin-unused-imports@3.2.0(@typescript-eslint/eslint-plugin@6.19.0)(eslint@8.57.0):
resolution: {integrity: sha512-6uXyn6xdINEpxE1MtDjxQsyXB37lfyO2yKGVVgtD7WEWQGORSOZjgrD6hBhvGv4/SO+TOlS+UnC6JppRqbuwGQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
'@typescript-eslint/eslint-plugin': 6 - 7
eslint: '8'
peerDependenciesMeta:
'@typescript-eslint/eslint-plugin':
optional: true
dependencies:
'@typescript-eslint/eslint-plugin': 6.19.0(@typescript-eslint/parser@6.19.0)(eslint@8.57.0)(typescript@5.4.2)
eslint: 8.57.0
eslint-rule-composer: 0.3.0
dev: true
/eslint-rule-composer@0.3.0:
resolution: {integrity: sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==}
engines: {node: '>=4.0.0'}
dev: true
/eslint-scope@5.1.1: /eslint-scope@5.1.1:
resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==}
engines: {node: '>=8.0.0'} engines: {node: '>=8.0.0'}

View File

@ -12,19 +12,23 @@ describe('AppComponent', () => {
it('should create the app', () => { it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance; const app = fixture.componentInstance;
expect(app).toBeTruthy(); expect(app).toBeTruthy();
}); });
it(`should have the 'frontend' title`, () => { it('should have the "frontend" title', () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance; const app = fixture.componentInstance;
expect(app.title).toEqual('frontend'); expect(app.title).toEqual('frontend');
}); });
it('should render title', () => { it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement; const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain( expect(compiled.querySelector('h1')?.textContent).toContain(
'Hello, frontend' 'Hello, frontend'
); );

View File

@ -8,6 +8,4 @@ import { RouterOutlet } from '@angular/router';
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrl: './app.component.scss', styleUrl: './app.component.scss',
}) })
export class AppComponent { export class AppComponent {}
constructor() {}
}

View File

@ -96,7 +96,7 @@
<button <button
pButton pButton
type="submit" type="submit"
label="✨ Jetzt KOSTENFREI registrieren ✨"></button> label="✨ Jetzt KOSTENFREI loslegen ✨"></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -82,7 +82,6 @@ export class RegisterRootComponent implements OnInit {
this.isRegisterSignal.set(false); this.isRegisterSignal.set(false);
this.isSignupSignal.set(true); this.isSignupSignal.set(true);
} }
this.isDisplayButtons.set(false); this.isDisplayButtons.set(false);
} }

View File

@ -3,10 +3,13 @@ import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export function customEmailValidator(): ValidatorFn { export function customEmailValidator(): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => { return (control: AbstractControl): ValidationErrors | null => {
const value = control.value; const value = control.value;
if (value.length < 4) { if (value.length < 4) {
return { emailTooShort: true }; return { emailTooShort: true };
} }
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailPattern.test(value) ? null : { emailInvalid: true }; return emailPattern.test(value) ? null : { emailInvalid: true };
}; };
} }

View File

@ -3,6 +3,7 @@ import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export function customPasswordValidator(): ValidatorFn { export function customPasswordValidator(): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => { return (control: AbstractControl): ValidationErrors | null => {
const value = control.value; const value = control.value;
return value.length >= 8 ? null : { passwordTooShort: true }; return value.length >= 8 ? null : { passwordTooShort: true };
}; };
} }