Commit e10ddb2a63bc8fa32428d3ffc0c5188c150a03e5

Authored by Daniela Feitosa
Committed by Michel Felipe
1 parent 503976b5

Added notification when user is created

Also added link to register on login modal
src/app/account/register.component.ts
1 1 import { Inject, Input, Component, Output, EventEmitter, provide } from 'ng-forward';
2   -import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service";
  2 +import { RegisterService } from "./../../lib/ng-noosfero-api/http/register.service";
  3 +import { NotificationService } from "./../shared/services/notification.service";
3 4  
4 5 @Component({
5 6 selector: 'noosfero-register',
... ... @@ -9,11 +10,11 @@ import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service
9 10 ]
10 11 })
11 12  
12   -@Inject("$state", RegisterService)
  13 +@Inject("$state", RegisterService, NotificationService)
13 14 export class RegisterComponent {
14 15 @Input() account: any;
15 16  
16   - constructor(private $state: ng.ui.IStateService, public registerService: RegisterService) {
  17 + constructor(private $state: ng.ui.IStateService, public registerService: RegisterService, private notificationService: NotificationService) {
17 18 this.account = {};
18 19 }
19 20  
... ... @@ -22,13 +23,13 @@ export class RegisterComponent {
22 23 this.registerService.createAccount(this.account).then((response) => {
23 24 if (response.status === 201) {
24 25 this.$state.transitionTo('main.environment');
  26 + this.notificationService.success({ title: "account.register.success.title", message: "account.register.success.message" });
25 27 } else {
26 28 throw new Error('Invalid attributes');
27 29 }
28 30 });
29 31 } else {
30   - alert("Wrong password confirmation.");
  32 + this.notificationService.error({ message: "account.register.passwordConfirmation.failed" });
31 33 }
32 34 }
33   -
34 35 }
... ...
src/app/login/login.html
... ... @@ -21,4 +21,7 @@
21 21 </div>
22 22 <button type="submit" class="btn btn-default btn-block" ng-click="vm.login()">{{"auth.form.login_button" | translate}}</button>
23 23 </form>
  24 + <div class="text-center">
  25 + <a ui-sref="main.register" ng-click="$close()">{{"auth.createAccount" | translate}}</a>
  26 + </div>
24 27 </div>
... ...
src/languages/en.json
... ... @@ -28,6 +28,7 @@
28 28 "auth.form.password": "Password",
29 29 "auth.form.keepLoggedIn": "Keep me logged in",
30 30 "auth.form.login_button": "Login",
  31 + "auth.createAccount": "Create account",
31 32 "navbar.content_viewer_actions.new_item": "New Item",
32 33 "navbar.profile_actions.new_item": "New Item",
33 34 "account.register.welcomeMessage": "Nice to have you there!",
... ...
src/languages/pt.json
... ... @@ -28,6 +28,7 @@
28 28 "auth.form.password": "Senha",
29 29 "auth.form.keepLoggedIn": "Continuar logado",
30 30 "auth.form.login_button": "Login",
  31 + "auth.createAccount": "Criar conta",
31 32 "navbar.content_viewer_actions.new_item": "Novo Item",
32 33 "navbar.profile_actions.new_item": "Novo Item",
33 34 "navbar.content_viewer_actions.new_post": "Novo Artigo",
... ... @@ -113,5 +114,8 @@
113 114 "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ",
114 115 "account.register.termsOfUseMessage": "termos de uso",
115 116 "account.register.signupMessage": "Criar Conta",
116   - "account.register.haveAccountMessage": "Já possui uma conta?"
  117 + "account.register.haveAccountMessage": "Já possui uma conta?",
  118 + "account.register.success.title": "Bom trabalho!",
  119 + "account.register.success.message": "Conta criada com sucesso!",
  120 + "account.register.passwordConfirmation.failed": "A confirmação de senha não corresponde à senha"
117 121 }
... ...