<commit_before>import {Component, OnInit} from '@angular/core';
import {RegisterService} from '../../services/register.service';
import {User} from '../../models/user';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';

@Component({
  selector: 'app-register',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {

  user: User;
  registered = false;
  message: string;
  error = false;
  registerForm: FormGroup;

  constructor(private fb: FormBuilder,
              private registerService: RegisterService) {
  }

  ngOnInit() {
    this.createForm();
  }

  onSubmit(): void {

    this.registerService.register(this.registerForm.value).subscribe(data => {
      this.registered = true;
      this.message = data.message;

    }, error => {
      this.error = true;
      this.message = error.message;
    });
  }

  private createForm(): void{
    this.registerForm = this.fb.group({
        username: ['', Validators.required, Validators.min(6)],
        fullname: ['', Validators.required],
        email: ['', Validators.required],
        password: ['', Validators.required, Validators.min(6)]
    });
  }

}
<commit_msg>minor fix on form validations<commit_after>import {Component, OnInit} from '@angular/core';
import {RegisterService} from '../../services/register.service';
import {User} from '../../models/user';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';

@Component({
  selector: 'app-register',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {

  user: User;
  registered = false;
  message: string;
  error = false;
  registerForm: FormGroup;

  constructor(private fb: FormBuilder,
              private registerService: RegisterService) {
  }

  ngOnInit() {
    this.createForm();
  }

  onSubmit(): void {

    this.registerService.register(this.registerForm.value).subscribe(data => {
      this.registered = true;
      this.message = data.message;

    }, error => {
      this.error = true;
      this.message = error.message;
    });
  }

  private createForm(): void{
    this.registerForm = this.fb.group({
        username: ['', [Validators.required, Validators.min(6)]],
        fullname: ['', Validators.required],
        email: ['', Validators.required],
        password: ['', [Validators.required, Validators.min(6)]]
    });
  }

}

{'fraction_non_alphanumeric': 0.15434083601286175, 'fraction_numerical': 0.001607717041800643, 'mean_word_length': 3.31369150779896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1079447', 'n_tokens_mistral': 736, 'n_tokens_neox': 721, 'n_words': 156}