mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#17 Added "method" property to alfresco login component
This commit is contained in:
@@ -85,6 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<main class="mdl-layout__content">
|
<main class="mdl-layout__content">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
<alfresco-login method="{{methodName}}"></alfresco-login>
|
||||||
<!--<router-outlet></router-outlet>-->
|
<!--<router-outlet></router-outlet>-->
|
||||||
<auth-router-outlet></auth-router-outlet>
|
<auth-router-outlet></auth-router-outlet>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -13,10 +13,11 @@ import {Login} from 'ng2-alfresco-login/ng2-alfresco-login';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-login',
|
selector: 'my-login',
|
||||||
template: ' <alfresco-login></alfresco-login>',
|
template: ' <alfresco-login method="{{methodName}}"></alfresco-login>',
|
||||||
directives: [Login]
|
directives: [Login]
|
||||||
})
|
})
|
||||||
export class MyLoginComponent {
|
export class MyLoginComponent {
|
||||||
|
methodName: string = 'POST';
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', './authe
|
|||||||
function Login(fb, auth, router) {
|
function Login(fb, auth, router) {
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
this.router = router;
|
this.router = router;
|
||||||
|
this.method = 'GET';
|
||||||
this.error = false;
|
this.error = false;
|
||||||
this.form = fb.group({
|
this.form = fb.group({
|
||||||
username: ['', common_1.Validators.compose([common_1.Validators.required, common_1.Validators.minLength(4)])],
|
username: ['', common_1.Validators.compose([common_1.Validators.required, common_1.Validators.minLength(4)])],
|
||||||
@@ -53,7 +54,7 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', './authe
|
|||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
this.auth.login('POST', value.username, value.password)
|
this.auth.login(this.method, value.username, value.password)
|
||||||
.subscribe(function (token) { return _this.router.navigate(['Home']); }, function () {
|
.subscribe(function (token) { return _this.router.navigate(['Home']); }, function () {
|
||||||
_this.error = true;
|
_this.error = true;
|
||||||
});
|
});
|
||||||
@@ -72,6 +73,10 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', './authe
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], Login.prototype, "method", void 0);
|
||||||
Login = __decorate([
|
Login = __decorate([
|
||||||
core_1.Component({
|
core_1.Component({
|
||||||
selector: 'alfresco-login',
|
selector: 'alfresco-login',
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"login.component.js","sourceRoot":"","sources":["login.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAcA;gBAII;;;;;mBAKG;gBACH,eAAY,EAAc,EAAS,IAAmB,EAAS,MAAa;oBAAzC,SAAI,GAAJ,IAAI,CAAe;oBAAS,WAAM,GAAN,MAAM,CAAO;oBAR5E,UAAK,GAAW,KAAK,CAAC;oBASlB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC;wBACjB,QAAQ,EAAE,CAAC,EAAE,EAAE,mBAAU,CAAC,OAAO,CAAC,CAAC,mBAAU,CAAC,QAAQ,EAAE,mBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClF,QAAQ,EAAE,CAAC,EAAE,EAAE,mBAAU,CAAC,QAAQ,CAAC;qBACtC,CAAC,CAAC;gBACP,CAAC;gBAED;;;;mBAIG;gBACH,wBAAQ,GAAR,UAAS,KAAS,EAAE,KAAK;oBAAzB,iBAWC;oBAVG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;wBACR,KAAK,CAAC,cAAc,EAA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AW,EAAE,sBAAsB;wBACnC,SAAS,EAAE,CAAC,qBAAqB,CAAC;qBAErC,CAAC;;yBAAA;gBAmDF,YAAC;YAAD,CAAC,AAlDD,IAkDC;YAlDD,yBAkDC,CAAA"}
|
@@ -1,4 +1,4 @@
|
|||||||
import {Component} from 'angular2/core';
|
import {Component, Input} from 'angular2/core';
|
||||||
import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
|
import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
|
||||||
import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';
|
import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';
|
||||||
import {Authentication} from './authentication.service';
|
import {Authentication} from './authentication.service';
|
||||||
@@ -13,6 +13,8 @@ declare let componentHandler;
|
|||||||
|
|
||||||
})
|
})
|
||||||
export class Login {
|
export class Login {
|
||||||
|
@Input() method: string = 'GET';
|
||||||
|
|
||||||
form:ControlGroup;
|
form:ControlGroup;
|
||||||
error:boolean = false;
|
error:boolean = false;
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@ export class Login {
|
|||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
this.auth.login('POST', value.username, value.password)
|
this.auth.login(this.method, value.username, value.password)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(token:any) => this.router.navigate(['Home']),
|
(token:any) => this.router.navigate(['Home']),
|
||||||
() => {
|
() => {
|
||||||
|
Reference in New Issue
Block a user