Commit e10ddb2a63bc8fa32428d3ffc0c5188c150a03e5
Committed by
Michel Felipe

1 parent
503976b5
Exists in
master
and in
7 other branches
Added notification when user is created
Also added link to register on login modal
Showing
4 changed files
with
15 additions
and
6 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,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
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.welcomeMessage": "Nice to have you there!", |
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", |
@@ -113,5 +114,8 @@ | @@ -113,5 +114,8 @@ | ||
113 | "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", | 114 | "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", |
114 | "account.register.termsOfUseMessage": "termos de uso", | 115 | "account.register.termsOfUseMessage": "termos de uso", |
115 | "account.register.signupMessage": "Criar Conta", | 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 | } |