Commit 4be49e915e42e33883bac9599f33b30455982672
1 parent
487015af
Exists in
updated_signup_page
Fixing registration - it is working now
Showing
7 changed files
with
35 additions
and
27 deletions
Show diff stats
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +export * from "./register.component"; | ... | ... |
src/app/account/register-component.html
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | |
| 38 | 38 | <div class="col-md-6 register-field"> |
| 39 | 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 | 41 | </div> |
| 42 | 42 | |
| 43 | 43 | <div class="col-md-12"> |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | </div> |
| 46 | 46 | |
| 47 | 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 | 49 | </div> |
| 50 | 50 | |
| 51 | 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 | 4 | @Component({ |
| 5 | 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 | 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 | 23 | } else { |
| 17 | 24 | alert("Wrong password confirmation."); |
| 18 | 25 | } | ... | ... |
src/app/account/register.service.ts
| ... | ... | @@ -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
| ... | ... | @@ -8,8 +8,6 @@ import {ProfileComponent} from "../profile/profile.component"; |
| 8 | 8 | import {BoxesComponent} from "../layout/boxes/boxes.component"; |
| 9 | 9 | import {BlockComponent} from "../layout/blocks/block.component"; |
| 10 | 10 | import {EnvironmentComponent} from "../environment/environment.component"; |
| 11 | -import {RegisterComponent} from "../account/register.component"; | |
| 12 | -import {RegisterService} from "../account/register.service"; | |
| 13 | 11 | import {EnvironmentHomeComponent} from "../environment/environment-home.component"; |
| 14 | 12 | import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component"; |
| 15 | 13 | import {DisplayContentBlockComponent} from "../layout/blocks/display-content/display-content-block.component"; |
| ... | ... | @@ -19,6 +17,7 @@ import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile |
| 19 | 17 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; |
| 20 | 18 | import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; |
| 21 | 19 | import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component"; |
| 20 | +import {RegisterComponent} from "../account/register.component"; | |
| 22 | 21 | |
| 23 | 22 | import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; |
| 24 | 23 | import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; |
| ... | ... | @@ -105,7 +104,7 @@ export class EnvironmentContent { |
| 105 | 104 | LoginBlockComponent, TagsBlockComponent, RegisterComponent |
| 106 | 105 | ].concat(plugins.mainComponents).concat(plugins.hotspots), |
| 107 | 106 | |
| 108 | - providers: [AuthService, SessionService, NotificationService, BodyStateClassesService, RegisterService] | |
| 107 | + providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] | |
| 109 | 108 | }) |
| 110 | 109 | @StateConfig([ |
| 111 | 110 | { | ... | ... |
| ... | ... | @@ -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 | +} | ... | ... |