Commit 4244355471f0eb0d59a065f3f4311c1664bbbc5f
Committed by
Michel Felipe

1 parent
bc91225e
Exists in
master
and in
7 other branches
Fixing registration - it is working now
Showing
7 changed files
with
35 additions
and
24 deletions
Show diff stats
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +export * from "./register.component"; |
src/app/account/register-component.html
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | 37 | ||
38 | <div class="col-md-6 register-field"> | 38 | <div class="col-md-6 register-field"> |
39 | <label for="password-confirmation">{{"account.register.passwordConfirmationLabel" | translate}}</label> | 39 | <label for="password-confirmation">{{"account.register.passwordConfirmationLabel" | translate}}</label> |
40 | - <input type="password" class="form-control" id="passwordConfirmation" placeholder="Password Confirmation" ng-model="ctrl.account.passwordConfirmation"> | 40 | + <input type="password" class="form-control" id="passwordConfirmation" placeholder="Password Confirmation" ng-model="ctrl.account.password_confirmation"> |
41 | </div> | 41 | </div> |
42 | 42 | ||
43 | <div class="col-md-12"> | 43 | <div class="col-md-12"> |
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | </div> | 45 | </div> |
46 | 46 | ||
47 | <div class="col-md-12"> | 47 | <div class="col-md-12"> |
48 | - <button type="submit" class="btn btn-default" ng-click="ctrl.signup(ctrl.account)">{{"account.register.signupMessage" | translate}}</button> | 48 | + <button type="submit" class="btn btn-default" ng-click="ctrl.signup()">{{"account.register.signupMessage" | translate}}</button> |
49 | </div> | 49 | </div> |
50 | 50 | ||
51 | </div> | 51 | </div> |
src/app/account/register.component.ts
1 | -import { Inject, Input, Component, Output, EventEmitter } from 'ng-forward'; | ||
2 | -import { RegisterService } from './register.service'; | 1 | +import { Inject, Input, Component, Output, EventEmitter, provide } from 'ng-forward'; |
2 | +import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service"; | ||
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
5 | selector: 'noosfero-register', | 5 | selector: 'noosfero-register', |
6 | - templateUrl: 'app/account/register-component.html' | 6 | + templateUrl: 'app/account/register-component.html', |
7 | + providers: [ | ||
8 | + provide('registerService', { useClass: RegisterService }) | ||
9 | + ] | ||
7 | }) | 10 | }) |
8 | 11 | ||
9 | -@Inject(RegisterService) | 12 | +@Inject("$state", RegisterService) |
10 | export class RegisterComponent { | 13 | export class RegisterComponent { |
11 | - constructor(private registerService: RegisterService) { } | 14 | + @Input() account: any; |
12 | 15 | ||
13 | - signup (account: any) { | ||
14 | - if (account.password === account.passwordConfirmation) { | ||
15 | - this.registerService.createAccount(account); | 16 | + constructor(private $state: ng.ui.IStateService, public registerService: RegisterService) { |
17 | + this.account = {}; | ||
18 | + } | ||
19 | + | ||
20 | + signup() { | ||
21 | + if (this.account.password === this.account.password_confirmation) { | ||
22 | + this.registerService.createAccount(this.account); | ||
16 | } else { | 23 | } else { |
17 | alert("Wrong password confirmation."); | 24 | alert("Wrong password confirmation."); |
18 | } | 25 | } |
src/app/account/register.service.ts
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -import { Injectable, Inject } from "ng-forward"; | ||
2 | -import {RestangularService} from "../../lib/ng-noosfero-api/http/restangular_service"; | ||
3 | - | ||
4 | -@Injectable() | ||
5 | -@Inject("Restangular") | ||
6 | -export class RegisterService { | ||
7 | - | ||
8 | - constructor(private Restangular: restangular.IService) { } | ||
9 | - | ||
10 | - createAccount(user: noosfero.User): ng.IPromise<noosfero.RestResult<noosfero.User>> { | ||
11 | - return this.Restangular.customPOST({account: user}, "register", null); | ||
12 | - } | ||
13 | -} |
src/app/login/session.service.ts
src/app/main/main.component.ts
@@ -21,6 +21,7 @@ import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-t | @@ -21,6 +21,7 @@ import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-t | ||
21 | import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component"; | 21 | import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component"; |
22 | import {CustomContentComponent} from "../profile/custom-content/custom-content.component"; | 22 | import {CustomContentComponent} from "../profile/custom-content/custom-content.component"; |
23 | import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; | 23 | import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; |
24 | +import {RegisterComponent} from "../account/register.component"; | ||
24 | 25 | ||
25 | import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; | 26 | import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; |
26 | import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; | 27 | import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; |
@@ -34,6 +35,7 @@ import {AuthService} from "../login/auth.service"; | @@ -34,6 +35,7 @@ import {AuthService} from "../login/auth.service"; | ||
34 | import {SessionService} from "../login/session.service"; | 35 | import {SessionService} from "../login/session.service"; |
35 | import {EnvironmentService} from "./../../lib/ng-noosfero-api/http/environment.service"; | 36 | import {EnvironmentService} from "./../../lib/ng-noosfero-api/http/environment.service"; |
36 | import {NotificationService} from "../shared/services/notification.service"; | 37 | import {NotificationService} from "../shared/services/notification.service"; |
38 | +import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service"; | ||
37 | 39 | ||
38 | import {BodyStateClassesService} from "./../layout/services/body-state-classes.service"; | 40 | import {BodyStateClassesService} from "./../layout/services/body-state-classes.service"; |
39 | 41 |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +import { Injectable, Inject } from "ng-forward"; | ||
2 | +import {RestangularService} from "./restangular_service"; | ||
3 | + | ||
4 | +@Injectable() | ||
5 | +@Inject("Restangular") | ||
6 | +export class RegisterService { | ||
7 | + constructor(private Restangular: restangular.IService) { | ||
8 | + this.Restangular = Restangular; | ||
9 | + } | ||
10 | + | ||
11 | + createAccount(user: noosfero.User): ng.IPromise<noosfero.RestResult<noosfero.User>> { | ||
12 | + return this.Restangular.all('').customPOST(user, "register", user); | ||
13 | + } | ||
14 | +} |