diff --git a/src/app/account/index.ts b/src/app/account/index.ts
new file mode 100644
index 0000000..766d67c
--- /dev/null
+++ b/src/app/account/index.ts
@@ -0,0 +1 @@
+export * from "./register.component";
diff --git a/src/app/account/register-component.html b/src/app/account/register-component.html
index da6b922..a9b4388 100644
--- a/src/app/account/register-component.html
+++ b/src/app/account/register-component.html
@@ -37,7 +37,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
diff --git a/src/app/account/register.component.ts b/src/app/account/register.component.ts
index 283b341..2d8324e 100644
--- a/src/app/account/register.component.ts
+++ b/src/app/account/register.component.ts
@@ -1,18 +1,25 @@
-import { Inject, Input, Component, Output, EventEmitter } from 'ng-forward';
-import { RegisterService } from './register.service';
+import { Inject, Input, Component, Output, EventEmitter, provide } from 'ng-forward';
+import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service";
@Component({
selector: 'noosfero-register',
- templateUrl: 'app/account/register-component.html'
+ templateUrl: 'app/account/register-component.html',
+ providers: [
+ provide('registerService', { useClass: RegisterService })
+ ]
})
-@Inject(RegisterService)
+@Inject("$state", RegisterService)
export class RegisterComponent {
- constructor(private registerService: RegisterService) { }
+ @Input() account: any;
- signup (account: any) {
- if (account.password === account.passwordConfirmation) {
- this.registerService.createAccount(account);
+ constructor(private $state: ng.ui.IStateService, public registerService: RegisterService) {
+ this.account = {};
+ }
+
+ signup() {
+ if (this.account.password === this.account.password_confirmation) {
+ this.registerService.createAccount(this.account);
} else {
alert("Wrong password confirmation.");
}
diff --git a/src/app/account/register.service.ts b/src/app/account/register.service.ts
deleted file mode 100644
index afb19b7..0000000
--- a/src/app/account/register.service.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Injectable, Inject } from "ng-forward";
-import {RestangularService} from "../../lib/ng-noosfero-api/http/restangular_service";
-
-@Injectable()
-@Inject("Restangular")
-export class RegisterService {
-
- constructor(private Restangular: restangular.IService) { }
-
- createAccount(user: noosfero.User): ng.IPromise> {
- return this.Restangular.customPOST({account: user}, "register", null);
- }
-}
diff --git a/src/app/login/session.service.ts b/src/app/login/session.service.ts
index cc33a54..2e04c15 100644
--- a/src/app/login/session.service.ts
+++ b/src/app/login/session.service.ts
@@ -23,4 +23,4 @@ export class SessionService {
return this.$localStorage.currentUser;
};
-}
\ No newline at end of file
+}
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts
index 3e4734c..b58b593 100644
--- a/src/app/main/main.component.ts
+++ b/src/app/main/main.component.ts
@@ -21,6 +21,7 @@ import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-t
import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component";
import {CustomContentComponent} from "../profile/custom-content/custom-content.component";
import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component";
+import {RegisterComponent} from "../account/register.component";
import {MembersBlockComponent} from "../layout/blocks/members/members-block.component";
import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component";
@@ -34,6 +35,7 @@ import {AuthService} from "../login/auth.service";
import {SessionService} from "../login/session.service";
import {EnvironmentService} from "./../../lib/ng-noosfero-api/http/environment.service";
import {NotificationService} from "../shared/services/notification.service";
+import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service";
import {BodyStateClassesService} from "./../layout/services/body-state-classes.service";
diff --git a/src/lib/ng-noosfero-api/http/register.service.ts b/src/lib/ng-noosfero-api/http/register.service.ts
new file mode 100644
index 0000000..9e1b0cf
--- /dev/null
+++ b/src/lib/ng-noosfero-api/http/register.service.ts
@@ -0,0 +1,14 @@
+import { Injectable, Inject } from "ng-forward";
+import {RestangularService} from "./restangular_service";
+
+@Injectable()
+@Inject("Restangular")
+export class RegisterService {
+ constructor(private Restangular: restangular.IService) {
+ this.Restangular = Restangular;
+ }
+
+ createAccount(user: noosfero.User): ng.IPromise> {
+ return this.Restangular.all('').customPOST(user, "register", user);
+ }
+}
--
libgit2 0.21.2