home.ts 1.64 KB
Newer Older
1 2 3
import {Router, ActivatedRoute, Params} from '@angular/router';
import {OnInit, Component} from '@angular/core';
import { LoginInfoActions } from '../actions/logininfo.actions';
Open Source Developer's avatar
Open Source Developer committed
4 5 6 7 8 9
import {
    FormBuilder,
    FormGroup,
    FormControl,
    FormArray
} from '@angular/forms';
10
import { AppSettings } from '../app.settings';
11 12 13 14
@Component({
  selector: 'home',
  template: `
  <div>
Open Source Developer's avatar
Open Source Developer committed
15
    <h4>Στοιχεία Σύνδεσης</h4>
16 17
	   <form [formGroup]="formGroup" method = "POST" action="http://eepal.dev/drupal/oauth/login" #form>
            <input type="hidden" name="X-oauth-enabled" value="true">
Open Source Developer's avatar
Open Source Developer committed
18 19
            <div class="row">
              <div class="col-md-2 col-md-offset-5">
20 21
                <button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
                Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
Open Source Developer's avatar
Open Source Developer committed
22 23 24
                </button>
            </div>
        </div>
25
     </form>
26 27 28
  </div>
  `
})
29
export default class Home implements OnInit{
Open Source Developer's avatar
Open Source Developer committed
30
	public formGroup: FormGroup;
31 32 33
       constructor(private fb: FormBuilder,
           private _ata: LoginInfoActions,
           private activatedRoute: ActivatedRoute) {
Open Source Developer's avatar
Open Source Developer committed
34 35 36 37 38 39
       this.formGroup = this.fb.group({
            Username: [],
            Paswd : []
            });
        };

40 41 42 43 44 45 46 47 48 49 50 51
    ngOnInit() {
    // subscribe to router event
        this.activatedRoute.queryParams.subscribe((params: Params) => {
        let authToken = params['auth_token'];
        let authRole = params['auth_role'];
        this._ata.saveLoginInfo({auth_token: authToken, auth_role: authRole});
        console.log(authToken);

      });
  }


Open Source Developer's avatar
Open Source Developer committed
52 53 54

	checkvalidation() {

Open Source Developer's avatar
Open Source Developer committed
55
        }
56
    }