Use iframe webcomponent to allow more flexibility in terms of languages

This commit is contained in:
Gabor PEK
2018-03-12 16:48:15 +01:00
parent 97ed48b408
commit adff2c5e1b
7 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,39 @@
<!--
<div>
<h1>Login page</h1>
<form #loginForm="ngForm" (submit)="onSubmit()" [hidden]="submitted">
<div class="form-group">
<label for="email_input">Email:</label>
<input
id="email_input"
class="form-control"
type="email"
name="email"
placeholder="Enter email"
[(ngModel)]="model.email"
>
</div>
<div class="form-group">
<label for="password_input">Password:</label>
<input
id="password_input"
class="form-control"
type="password"
name="password"
placeholder="Password"
[(ngModel)]="model.password"
>
</div>
<button type="submit" class="btn tao-btn-primary">Submit</button>
</form>
<div [hidden]="!submitted">
<p>
Logged in as {{logged_in_email}}.
You <em><span *ngIf="!is_admin">don't </span>have</em> admin privileges.
</p>
</div>
</div>
-->
<div class="row-container">
</div>

View File

View File

@ -0,0 +1,36 @@
import { HttpClient } from '@angular/common/http';
import {Component, OnDestroy, OnInit} from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Login } from './web';
import {DeploymentNotificationService} from '../services/deployment-notification.service';
import {Subscription} from 'rxjs/Subscription';
@Component({
selector: 'app-web',
templateUrl: './web.component.html',
styleUrls: ['./web.component.scss']
})
export class LoginComponent {
model = new Login('', '');
submitted = false;
is_admin: boolean;
logged_in_email: string;
constructor(
private http: HttpClient
) {}
onSubmit() {
this.postLogin(this.model).subscribe(
res => {
this.logged_in_email = res['email'];
this.is_admin = res['is_admin'];
}
);
this.submitted = true;
}
postLogin(login: Login): Observable<any> {
return this.http.post<Login>('/web', login);
}
}

8
src/app/web/web.ts Normal file
View File

@ -0,0 +1,8 @@
export class Login {
constructor(
public email: string,
public password: string
) {}
}