Commit 8863d03bac66edc94dcba8ccb0de36213ff4f804

Authored by Daniela Feitosa
Committed by Michel Felipe
1 parent bee74edc

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,21 +28,9 @@
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   - "account.register.welcomeMessage": "Nice to have you there!",
34   - "account.register.seeMoreMessage": "See more ",
35   - "account.register.informationsMessage": "informations",
36   - "account.register.firstNameLabel": "First Name",
37   - "account.register.lastNameLabel": "Last Name",
38   - "account.register.usernameLabel": "Username",
39   - "account.register.emailLabel": "Email",
40   - "account.register.passwordLabel": "Password",
41   - "account.register.passwordConfirmationLabel": "Password Confirmation",
42   - "account.register.accountCreatingMessage": "By creating an account, you are agreeing with the ",
43   - "account.register.signupMessage": "Create Account",
44   - "account.register.haveAccountMessage": "Already have an account?",
45   - "account.register.termsOfUseMessage": "terms of use",
46 34 "navbar.content_viewer_actions.new_post": "New Post",
47 35 "navbar.content_viewer_actions.new_discussion": "New Discussion",
48 36 "navbar.profile_actions.new_discussion": "New Discussion",
... ... @@ -110,5 +98,21 @@
110 98 "block.edition.display_user.all": "All users",
111 99 "block.edition.display_user.logged": "Logged",
112 100 "block.edition.display_user.not_logged": "Not logged",
113   - "block.edition.language.label": "Show for:"
  101 + "block.edition.language.label": "Show for:",
  102 + "account.register.welcomeMessage": "Nice to have you there!",
  103 + "account.register.seeMoreMessage": "See more ",
  104 + "account.register.informationsMessage": "informations",
  105 + "account.register.firstNameLabel": "First Name",
  106 + "account.register.lastNameLabel": "Last Name",
  107 + "account.register.usernameLabel": "Username",
  108 + "account.register.emailLabel": "Email",
  109 + "account.register.passwordLabel": "Password",
  110 + "account.register.passwordConfirmationLabel": "Password Confirmation",
  111 + "account.register.accountCreatingMessage": "By creating an account, you are agreeing with the ",
  112 + "account.register.signupMessage": "Create Account",
  113 + "account.register.haveAccountMessage": "Already have an account?",
  114 + "account.register.termsOfUseMessage": "terms of use",
  115 + "account.register.success.title": "Good job!",
  116 + "account.register.success.message": "Account created!",
  117 + "account.register.passwordConfirmation.failed": "Wrong password confirmation"
114 118 }
... ...
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",
... ... @@ -110,5 +111,8 @@
110 111 "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ",
111 112 "account.register.termsOfUseMessage": "termos de uso",
112 113 "account.register.signupMessage": "Criar Conta",
113   - "account.register.haveAccountMessage": "Já possui uma conta?"
  114 + "account.register.haveAccountMessage": "Já possui uma conta?",
  115 + "account.register.success.title": "Bom trabalho!",
  116 + "account.register.success.message": "Conta criada com sucesso!",
  117 + "account.register.passwordConfirmation.failed": "A confirmação de senha não corresponde à senha"
114 118 }
... ...