diff options
Diffstat (limited to 'so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts')
-rw-r--r-- | so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts deleted file mode 100644 index 4a3f4e6b0f..0000000000 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - ============LICENSE_START======================================================= - Copyright (C) 2019 Samsung. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - SPDX-License-Identifier: Apache-2.0 - ============LICENSE_END========================================================= - - @authors: k.kazak@samsung.com - **/ - -import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup, Validators, ReactiveFormsModule} from "@angular/forms"; -import {ActivatedRoute, Router} from "@angular/router"; -import {AuthenticationService} from "../authentication.service"; -import {first} from "rxjs/internal/operators"; - -@Component({ - selector: 'app-login', - templateUrl: './login.component.html', - styleUrls: [] -}) -export class LoginComponent implements OnInit { - - loginForm: FormGroup; - loading = false; - submitted = false; - returnUrl: string; - error = ''; - - constructor(private formBuilder: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private authenticationService: AuthenticationService) { } - - ngOnInit() { - this.loginForm = this.formBuilder.group({ - username: ['', Validators.required], - password: ['', Validators.required] - }); - - // logout - this.authenticationService.logout(); - - this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; - } - - // convenience getter for easy access to form fields - get f() { return this.loginForm.controls; } - - onSubmit() { - this.submitted = true; - - // stop here if form is invalid - if (this.loginForm.invalid) { - return; - } - - this.loading = true; - this.authenticationService.login(this.f.username.value, this.f.password.value) - .subscribe( - next => { - this.router.navigate([this.returnUrl]); - }, - error => { - this.error = error; - this.loading = false; - }); - } -} |