Commit 8863d03bac66edc94dcba8ccb0de36213ff4f804
Committed by
Michel Felipe
1 parent
bee74edc
Added notification when user is created
Also added link to register on login modal
Showing
4 changed files
with
32 additions
and
20 deletions
Show diff stats
src/app/account/register.component.ts
| 1 | import { Inject, Input, Component, Output, EventEmitter, provide } from 'ng-forward'; | 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 | @Component({ | 5 | @Component({ |
| 5 | selector: 'noosfero-register', | 6 | selector: 'noosfero-register', |
| @@ -9,11 +10,11 @@ import {RegisterService} from "./../../lib/ng-noosfero-api/http/register.service | @@ -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 | export class RegisterComponent { | 14 | export class RegisterComponent { |
| 14 | @Input() account: any; | 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 | this.account = {}; | 18 | this.account = {}; |
| 18 | } | 19 | } |
| 19 | 20 | ||
| @@ -22,13 +23,13 @@ export class RegisterComponent { | @@ -22,13 +23,13 @@ export class RegisterComponent { | ||
| 22 | this.registerService.createAccount(this.account).then((response) => { | 23 | this.registerService.createAccount(this.account).then((response) => { |
| 23 | if (response.status === 201) { | 24 | if (response.status === 201) { |
| 24 | this.$state.transitionTo('main.environment'); | 25 | this.$state.transitionTo('main.environment'); |
| 26 | + this.notificationService.success({ title: "account.register.success.title", message: "account.register.success.message" }); | ||
| 25 | } else { | 27 | } else { |
| 26 | throw new Error('Invalid attributes'); | 28 | throw new Error('Invalid attributes'); |
| 27 | } | 29 | } |
| 28 | }); | 30 | }); |
| 29 | } else { | 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,4 +21,7 @@ | ||
| 21 | </div> | 21 | </div> |
| 22 | <button type="submit" class="btn btn-default btn-block" ng-click="vm.login()">{{"auth.form.login_button" | translate}}</button> | 22 | <button type="submit" class="btn btn-default btn-block" ng-click="vm.login()">{{"auth.form.login_button" | translate}}</button> |
| 23 | </form> | 23 | </form> |
| 24 | + <div class="text-center"> | ||
| 25 | + <a ui-sref="main.register" ng-click="$close()">{{"auth.createAccount" | translate}}</a> | ||
| 26 | + </div> | ||
| 24 | </div> | 27 | </div> |
src/languages/en.json
| @@ -28,21 +28,9 @@ | @@ -28,21 +28,9 @@ | ||
| 28 | "auth.form.password": "Password", | 28 | "auth.form.password": "Password", |
| 29 | "auth.form.keepLoggedIn": "Keep me logged in", | 29 | "auth.form.keepLoggedIn": "Keep me logged in", |
| 30 | "auth.form.login_button": "Login", | 30 | "auth.form.login_button": "Login", |
| 31 | + "auth.createAccount": "Create account", | ||
| 31 | "navbar.content_viewer_actions.new_item": "New Item", | 32 | "navbar.content_viewer_actions.new_item": "New Item", |
| 32 | "navbar.profile_actions.new_item": "New Item", | 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 | "navbar.content_viewer_actions.new_post": "New Post", | 34 | "navbar.content_viewer_actions.new_post": "New Post", |
| 47 | "navbar.content_viewer_actions.new_discussion": "New Discussion", | 35 | "navbar.content_viewer_actions.new_discussion": "New Discussion", |
| 48 | "navbar.profile_actions.new_discussion": "New Discussion", | 36 | "navbar.profile_actions.new_discussion": "New Discussion", |
| @@ -110,5 +98,21 @@ | @@ -110,5 +98,21 @@ | ||
| 110 | "block.edition.display_user.all": "All users", | 98 | "block.edition.display_user.all": "All users", |
| 111 | "block.edition.display_user.logged": "Logged", | 99 | "block.edition.display_user.logged": "Logged", |
| 112 | "block.edition.display_user.not_logged": "Not logged", | 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,6 +28,7 @@ | ||
| 28 | "auth.form.password": "Senha", | 28 | "auth.form.password": "Senha", |
| 29 | "auth.form.keepLoggedIn": "Continuar logado", | 29 | "auth.form.keepLoggedIn": "Continuar logado", |
| 30 | "auth.form.login_button": "Login", | 30 | "auth.form.login_button": "Login", |
| 31 | + "auth.createAccount": "Criar conta", | ||
| 31 | "navbar.content_viewer_actions.new_item": "Novo Item", | 32 | "navbar.content_viewer_actions.new_item": "Novo Item", |
| 32 | "navbar.profile_actions.new_item": "Novo Item", | 33 | "navbar.profile_actions.new_item": "Novo Item", |
| 33 | "navbar.content_viewer_actions.new_post": "Novo Artigo", | 34 | "navbar.content_viewer_actions.new_post": "Novo Artigo", |
| @@ -110,5 +111,8 @@ | @@ -110,5 +111,8 @@ | ||
| 110 | "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", | 111 | "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", |
| 111 | "account.register.termsOfUseMessage": "termos de uso", | 112 | "account.register.termsOfUseMessage": "termos de uso", |
| 112 | "account.register.signupMessage": "Criar Conta", | 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 | } |