Commit 207be9ec3482b779ad224e7593dd5166a1608b48
Committed by
Michel Felipe

1 parent
011ca4fd
Adds account register module
Adjusts the style of the component according with its prototype Translates messages of the signup page. Fixes the post request, using the 2nd parameter as string instead of object. Signed-off-by: DylanGuedes <djmgguedes@gmail.com> Signed-off-by: Omar Junior <omarroinuj@gmail.com> Signed-off-by: Sabryna Sousa <sabryna.sousa1323@gmail.com> Signed-off-by: Victor Arnaud <victorhad@gmail.com>
Showing
8 changed files
with
172 additions
and
1 deletions
Show diff stats
... | ... | @@ -0,0 +1,56 @@ |
1 | +<div class="register-page"> | |
2 | + <div class="welcome-message"> | |
3 | + <h1>{{"account.register.welcomeMessage" | translate }}</h1> | |
4 | + <p> | |
5 | + "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..." | |
6 | + "There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..." | |
7 | + </p> | |
8 | + <p>{{"account.register.seeMoreMessage" | translate}}<a href="#">{{"account.register.informationsMessage" | translate}}</a></p> | |
9 | + </div> | |
10 | + <form> | |
11 | + <div class="row"> | |
12 | + <div class="col-md-6 register-field"> | |
13 | + <label for="name">{{"account.register.firstNameLabel" | translate }}</label> | |
14 | + <input type="text" class="form-control" id="name" placeholder="joao" ng-model="ctrl.account.name"> | |
15 | + </div> | |
16 | + | |
17 | + <div class="col-md-6 register-field"> | |
18 | + <label for="lastName">{{"account.register.lastNameLabel" | translate }}</label> | |
19 | + <input type="text" class="form-control" id="lastName" placeholder="silva" ng-model="ctrl.account.lastName"> | |
20 | + </div> | |
21 | + | |
22 | + <div class="col-md-12 register-field"> | |
23 | + <label for="login">{{"account.register.usernameLabel" | translate }}</label> | |
24 | + <input type="text" class="form-control" id="login" placeholder="username" ng-model="ctrl.account.login"> | |
25 | + <p class="light-text">ex: ola.coop.br/joaosilva</p> | |
26 | + </div> | |
27 | + | |
28 | + <div class="col-md-12 register-field"> | |
29 | + <label for="email">{{"account.register.emailLabel" | translate }}</label> | |
30 | + <input type="text" class="form-control" id="email" placeholder="Email" ng-model="ctrl.account.email"> | |
31 | + </div> | |
32 | + | |
33 | + <div class="col-md-6 register-field"> | |
34 | + <label for="password">{{"account.register.passwordLabel" | translate }}</label> | |
35 | + <input type="password" class="form-control" id="password" placeholder="Password" ng-model="ctrl.account.password"> | |
36 | + </div> | |
37 | + | |
38 | + <div class="col-md-6 register-field"> | |
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"> | |
41 | + </div> | |
42 | + | |
43 | + <div class="col-md-12"> | |
44 | + <p class="terms-info">{{"account.register.accountCreatingMessage" | translate}} <a href="#">{{"account.register.termsOfUseMessage" | translate}}</a>.</p> | |
45 | + </div> | |
46 | + | |
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> | |
49 | + </div> | |
50 | + | |
51 | + </div> | |
52 | + </form> | |
53 | + | |
54 | + <p class="already-registered-message">{{"account.register.haveAccountMessage" | translate}}</p> | |
55 | + | |
56 | +</div> | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +import { Inject, Input, Component, Output, EventEmitter, } from 'ng-forward'; | |
2 | + | |
3 | +@Component({ | |
4 | + selector: 'noosfero-register', | |
5 | + templateUrl: 'app/account/register-component.html', | |
6 | +}) | |
7 | + | |
8 | +@Inject("$http") | |
9 | +export class RegisterComponent { | |
10 | + constructor(private $http: ng.IHttpService) { } | |
11 | + | |
12 | + signup (account: any) { | |
13 | + if (account.password === account.passwordConfirmation) { | |
14 | + this.$http.post("http://localhost:3000/api/v1/register", "login="+account.login+"&email="+account.email+"&password="+account.password).then((response) => { | |
15 | + console.log("User " + account.login + " created, please activate your account."); | |
16 | + }); | |
17 | + } else { | |
18 | + alert("Wrong password confirmation."); | |
19 | + } | |
20 | + } | |
21 | + | |
22 | +} | ... | ... |
... | ... | @@ -0,0 +1,38 @@ |
1 | +.register-page button { | |
2 | + width: 100%; | |
3 | + text-transform: uppercase; | |
4 | + font-weight: 600; | |
5 | +} | |
6 | + | |
7 | +.register-page .light-text { | |
8 | + color: #BBB; | |
9 | + margin-top: 0px; | |
10 | + margin-bottom: 0px; | |
11 | + font-weight: 600; | |
12 | +} | |
13 | + | |
14 | +.register-page .terms-info { | |
15 | + margin-top: 30px; | |
16 | + margin-bottom: 30px; | |
17 | +} | |
18 | + | |
19 | +.register-page .welcome-message { | |
20 | + text-align: center; | |
21 | +} | |
22 | + | |
23 | +.register-page .already-registered-message { | |
24 | + margin-top: 60px; | |
25 | + text-align: center; | |
26 | +} | |
27 | + | |
28 | +.register-page input { | |
29 | + height: 40px; | |
30 | +} | |
31 | + | |
32 | +.register-page .register-field { | |
33 | + margin-bottom: 25px; | |
34 | +} | |
35 | + | |
36 | +.register-page input:focus { | |
37 | + border: 2px solid #bbb; | |
38 | +} | ... | ... |
src/app/layout/navbar/navbar.html
... | ... | @@ -20,6 +20,12 @@ |
20 | 20 | <a ng-href="#" ng-click="ctrl.openLogin()">{{"navbar.login" | translate}}</a> |
21 | 21 | </li> |
22 | 22 | |
23 | + <li ng-show="!ctrl.currentUser"> | |
24 | + <a ui-sref="main.register"> | |
25 | + Sign Up | |
26 | + </a> | |
27 | + </li> | |
28 | + | |
23 | 29 | <li class="dropdown profile-menu" ng-show="ctrl.currentUser" uib-dropdown> |
24 | 30 | <a href="#" class="dropdown-toggle" aria-expanded="false" uib-dropdown-toggle> |
25 | 31 | <noosfero-profile-image [profile]="ctrl.currentUser.person" class="profile-image"></noosfero-profile-image> | ... | ... |
src/app/main/main.component.ts
... | ... | @@ -9,6 +9,7 @@ import {BoxesComponent} from "../layout/boxes/boxes.component"; |
9 | 9 | import {BlockContentComponent} from "../layout/blocks/block-content.component"; |
10 | 10 | import {BlockComponent} from "../layout/blocks/block.component"; |
11 | 11 | import {EnvironmentComponent} from "../environment/environment.component"; |
12 | +import {RegisterComponent} from "../account/register.component"; | |
12 | 13 | import {EnvironmentHomeComponent} from "../environment/environment-home.component"; |
13 | 14 | import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component"; |
14 | 15 | import {DisplayContentBlockComponent} from "../layout/blocks/display-content/display-content-block.component"; |
... | ... | @@ -147,6 +148,18 @@ export class EnvironmentContent { |
147 | 148 | } |
148 | 149 | }, |
149 | 150 | { |
151 | + url: '/account/signup', | |
152 | + component: RegisterComponent, | |
153 | + name: 'main.register', | |
154 | + views: { | |
155 | + "content": { | |
156 | + templateUrl: "app/account/register.html", | |
157 | + controller: RegisterComponent, | |
158 | + controllerAs: "vm" | |
159 | + } | |
160 | + } | |
161 | + }, | |
162 | + { | |
150 | 163 | url: "^/:profile", |
151 | 164 | abstract: true, |
152 | 165 | component: ProfileComponent, | ... | ... |
src/languages/en.json
... | ... | @@ -30,6 +30,19 @@ |
30 | 30 | "auth.form.login_button": "Login", |
31 | 31 | "navbar.content_viewer_actions.new_item": "New Item", |
32 | 32 | "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", | |
33 | 46 | "navbar.content_viewer_actions.new_post": "New Post", |
34 | 47 | "navbar.content_viewer_actions.new_discussion": "New Discussion", |
35 | 48 | "navbar.profile_actions.new_discussion": "New Discussion", | ... | ... |
src/languages/pt.json
... | ... | @@ -97,5 +97,18 @@ |
97 | 97 | "block.edition.display_user.all": "Todos os usuários", |
98 | 98 | "block.edition.display_user.logged": "Logados", |
99 | 99 | "block.edition.display_user.not_logged": "Não logados", |
100 | - "block.edition.language.label": "Exibir para:" | |
100 | + "block.edition.language.label": "Exibir para:", | |
101 | + "account.register.welcomeMessage": "Ótimo ter você aqui!", | |
102 | + "account.register.seeMoreMessage": "Saiba mais ", | |
103 | + "account.register.informationsMessage": "informações", | |
104 | + "account.register.firstNameLabel": "Nome", | |
105 | + "account.register.lastNameLabel": "Sobrenome", | |
106 | + "account.register.usernameLabel": "Nome de usuário", | |
107 | + "account.register.emailLabel": "Email", | |
108 | + "account.register.passwordLabel": "Senha", | |
109 | + "account.register.passwordConfirmationLabel": "Confirmar senha", | |
110 | + "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", | |
111 | + "account.register.termsOfUseMessage": "termos de uso", | |
112 | + "account.register.signupMessage": "Criar Conta", | |
113 | + "account.register.haveAccountMessage": "Já possui uma conta?" | |
101 | 114 | } | ... | ... |