UNPKG

smart-house-frontend

Version:
2 lines 7.52 kB
webpackJsonp([5],{602:function(e,t,n){"use strict";var i=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},r=n(3),a=n(389),s=n(387),c=n(603),d=n(606),l=n(608),u=function(){function t(){}return t=i([r.NgModule({id:e.id,imports:[s.SharedModule,a.FormsModule,l.routing],providers:[],declarations:[c.LoginComponent,d.FbCallbackComponent]}),o("design:paramtypes",[])],t)}();t.LoginModule=u},603:function(e,t,n){"use strict";var i=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},r=n(3),a=n(29),s=n(22),c=n(77),d=n(383),l="/auth/login-facebook",u="redirect_uri",f="/login/fb-callback",p=function(){function e(e,t,n,i,o){var r=this;this.auth=e,this.router=t,this.activateRoute=n,this.location=i,this.windowRef=o,this.credentials={email:null,password:null},this.loggingError=!1,this.fbLoggingError=!1,this.activateRoute.params.subscribe(function(e){r.fbLoggingError="fb"===e.error})}return e.prototype.login=function(){var e=this;this.loginSubscription=this.auth.login(this.credentials).subscribe(function(){e.router.navigate(["/"])},function(){e.loggingError=!0})},e.prototype.loginFb=function(){this.windowRef.nativeWindow.location.href=l+"?"+u+"="+encodeURIComponent(this.windowRef.nativeWindow.location.origin+this.location.prepareExternalUrl(f))},e.prototype.ngOnDestroy=function(){this.loginSubscription&&this.loginSubscription.unsubscribe()},e=i([r.Component({selector:"sh-login",styles:[n(604)],template:n(605)}),o("design:paramtypes",["function"==typeof(t="undefined"!=typeof c.AuthService&&c.AuthService)&&t||Object,"function"==typeof(p="undefined"!=typeof a.Router&&a.Router)&&p||Object,"function"==typeof(g="undefined"!=typeof a.ActivatedRoute&&a.ActivatedRoute)&&g||Object,"function"==typeof(b="undefined"!=typeof s.Location&&s.Location)&&b||Object,"function"==typeof(h="undefined"!=typeof d.WindowRef&&d.WindowRef)&&h||Object])],e);var t,p,g,b,h}();t.LoginComponent=p},604:function(e,t){e.exports='.btn{width:100%;margin:0 0 20px}.btn-facebook{background-color:#3b5998}.btn-facebook i{background:url("/assets/facebook.svg") no-repeat;background-size:100%;display:inline-block;height:20px;width:20px;margin:2px 4px 4px 2px;vertical-align:middle}.validation-message-wrapper{position:relative;top:-10px}.validation-message{position:absolute}.input-field{position:relative}.input-field .validation-message{top:50px}\n'},605:function(e,t){e.exports='<div class="row">\n <div class="col m3"></div>\n <div class="col m6 section">\n <h2>Login</h2><br />\n <button (click)="loginFb($event)" class="btn btn-facebook">\n <i></i>Login with Facebook\n </button>\n <div\n [hidden]="!loggingError"\n class="validation-message-wrapper red-text text-darken-4">\n <div class="validation-message red-text text-darken-4">\n Email or password is invalid\n </div>\n </div>\n <div\n [hidden]="!fbLoggingError"\n class="validation-message-wrapper red-text text-darken-4">\n <div class="validation-message red-text text-darken-4">\n Facebook login error\n </div>\n </div>\n <form\n (ngSubmit)="login()"\n #loginForm="ngForm">\n <div class="input-field">\n <input\n type="text"\n [(ngModel)]="credentials.email"\n #email="ngModel"\n name="email"\n placeholder="Email"\n required />\n <div\n [hidden]="!email.touched || email.valid"\n class="validation-message red-text text-darken-4">\n Email should be filled\n </div>\n </div>\n <div class="input-field">\n <input\n type="password"\n [(ngModel)]="credentials.password"\n #password="ngModel"\n name="password"\n placeholder="Password"\n required />\n <div\n [hidden]="!password.touched || password.valid"\n class="validation-message red-text text-darken-4">\n Password should be filled\n </div>\n </div>\n <div class="input-field">\n <button\n [disabled]="!loginForm.valid"\n type="submit"\n class="waves-effect waves-light btn blue-grey darken-1">\n Submit\n </button>\n </div>\n <a [routerLink]="[\'/registration\']" class="btn btn-flat">Click here to Registration</a>\n </form>\n </div>\n <div class="col m3"></div>\n</div>\n'},606:function(e,t,n){"use strict";var i=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},r=n(3),a=n(383),s=n(77),c=n(29),d="/",l="/login/error/fb",u=function(){function e(e,t,n){this.windowRef=e,this.authService=t,this.router=n}return e.prototype.ngOnInit=function(){var e=this,t=this.parseAccessToken();t?this.subscription=this.authService.loginByAccessToken(t).subscribe(function(){e.router.navigate([d])},function(){e.router.navigate([l])}):this.router.navigate([l])},e.prototype.parseAccessToken=function(){var e=this.windowRef.nativeWindow.location.hash.substring(1),t=e.match(new RegExp("access_token=([^&]+)","i"));return t?t[1]:null},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e=i([r.Component({selector:"sh-fb-callback",template:n(607)}),o("design:paramtypes",["function"==typeof(t="undefined"!=typeof a.WindowRef&&a.WindowRef)&&t||Object,"function"==typeof(u="undefined"!=typeof s.AuthService&&s.AuthService)&&u||Object,"function"==typeof(f="undefined"!=typeof c.Router&&c.Router)&&f||Object])],e);var t,u,f}();t.FbCallbackComponent=u},607:function(e,t){e.exports="<p>Loading...</p>\n"},608:function(e,t,n){"use strict";var i=n(29),o=n(603),r=n(606);t.routes=[{path:"",component:o.LoginComponent},{path:"error/:error",component:o.LoginComponent},{path:"fb-callback",component:r.FbCallbackComponent}],t.routing=i.RouterModule.forChild(t.routes)}}); //# sourceMappingURL=5.map