Commit 3d2172f3dd876afaece772f954232918add851c8
Committed by
Michel Felipe

1 parent
fb1e923a
Exists in
master
and in
7 other branches
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
217 additions
and
47 deletions
Show diff stats
@@ -0,0 +1,56 @@ | @@ -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 @@ | @@ -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 @@ | @@ -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,6 +20,12 @@ | ||
20 | <a ng-href="#" ng-click="ctrl.openLogin()">{{"navbar.login" | translate}}</a> | 20 | <a ng-href="#" ng-click="ctrl.openLogin()">{{"navbar.login" | translate}}</a> |
21 | </li> | 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 | <li class="dropdown profile-menu" ng-show="ctrl.currentUser" uib-dropdown> | 29 | <li class="dropdown profile-menu" ng-show="ctrl.currentUser" uib-dropdown> |
24 | <a href="#" class="dropdown-toggle" aria-expanded="false" uib-dropdown-toggle> | 30 | <a href="#" class="dropdown-toggle" aria-expanded="false" uib-dropdown-toggle> |
25 | <noosfero-profile-image [profile]="ctrl.currentUser.person" class="profile-image"></noosfero-profile-image> | 31 | <noosfero-profile-image [profile]="ctrl.currentUser.person" class="profile-image"></noosfero-profile-image> |
src/app/main/main.component.ts
1 | import * as plugins from "../../plugins"; | 1 | import * as plugins from "../../plugins"; |
2 | -import { bundle, Component, StateConfig, Inject } from "ng-forward"; | ||
3 | -import { ArticleBlogComponent } from "./../article/types/blog/blog.component"; | ||
4 | - | ||
5 | -import { ArticleViewComponent } from "./../article/article-default-view.component"; | ||
6 | - | ||
7 | -import { ProfileComponent } from "../profile/profile.component"; | ||
8 | -import { BoxesComponent } from "../layout/boxes/boxes.component"; | ||
9 | -import { BlockContentComponent } from "../layout/blocks/block-content.component"; | ||
10 | -import { BlockComponent } from "../layout/blocks/block.component"; | ||
11 | -import { EnvironmentComponent } from "../environment/environment.component"; | ||
12 | -import { EnvironmentHomeComponent } from "../environment/environment-home.component"; | ||
13 | -import { PeopleBlockComponent } from "../layout/blocks/people/people-block.component"; | ||
14 | -import { DisplayContentBlockComponent } from "../layout/blocks/display-content/display-content-block.component"; | ||
15 | -import { LinkListBlockComponent } from "../layout/blocks/link-list/link-list-block.component"; | ||
16 | -import { RecentDocumentsBlockComponent } from "../layout/blocks/recent-documents/recent-documents-block.component"; | ||
17 | -import { ProfileImageBlockComponent } from "../layout/blocks/profile-image/profile-image-block.component"; | ||
18 | -import { RawHTMLBlockComponent } from "../layout/blocks/raw-html/raw-html-block.component"; | ||
19 | -import { StatisticsBlockComponent } from "../layout/blocks/statistics/statistics-block.component"; | ||
20 | -import { PersonTagsPluginInterestsBlockComponent } from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component"; | ||
21 | -import { TagsBlockComponent } from "../layout/blocks/tags/tags-block.component"; | ||
22 | -import { CustomContentComponent } from "../profile/custom-content/custom-content.component"; | ||
23 | -import { RecentActivitiesPluginActivitiesBlockComponent } from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; | ||
24 | - | ||
25 | -import { MembersBlockComponent } from "../layout/blocks/members/members-block.component"; | ||
26 | -import { CommunitiesBlockComponent } from "../layout/blocks/communities/communities-block.component"; | ||
27 | - | ||
28 | -import { LoginBlockComponent } from "../layout/blocks/login-block/login-block.component"; | ||
29 | - | ||
30 | -import { NoosferoTemplate } from "../shared/pipes/noosfero-template.filter"; | ||
31 | -import { DateFormat } from "../shared/pipes/date-format.filter"; | ||
32 | - | ||
33 | -import { AuthService } from "../login/auth.service"; | ||
34 | -import { SessionService } from "../login/session.service"; | ||
35 | -import { EnvironmentService } from "./../../lib/ng-noosfero-api/http/environment.service"; | ||
36 | -import { NotificationService } from "../shared/services/notification.service"; | ||
37 | - | ||
38 | -import { BodyStateClassesService } from "./../layout/services/body-state-classes.service"; | ||
39 | - | ||
40 | -import { Navbar } from "../layout/navbar/navbar"; | ||
41 | - | ||
42 | -import { SidebarComponent } from "../layout/sidebar/sidebar.component"; | ||
43 | - | ||
44 | -import { MainBlockComponent } from "../layout/blocks/main/main-block.component"; | ||
45 | -import { HtmlEditorComponent } from "../shared/components/html-editor/html-editor.component"; | ||
46 | -import { PermissionDirective } from "../shared/components/permission/permission.directive"; | ||
47 | -import { SearchComponent } from "../search/search.component"; | ||
48 | -import { SearchFormComponent } from "../search/search-form/search-form.component"; | 2 | +import {bundle, Component, StateConfig, Inject} from "ng-forward"; |
3 | +import {ArticleBlogComponent} from "./../article/types/blog/blog.component"; | ||
4 | + | ||
5 | +import {ArticleViewComponent} from "./../article/article-default-view.component"; | ||
6 | + | ||
7 | +import {ProfileComponent} from "../profile/profile.component"; | ||
8 | +import {BoxesComponent} from "../layout/boxes/boxes.component"; | ||
9 | +import {BlockContentComponent} from "../layout/blocks/block-content.component"; | ||
10 | +import {BlockComponent} from "../layout/blocks/block.component"; | ||
11 | +import {EnvironmentComponent} from "../environment/environment.component"; | ||
12 | +import {EnvironmentHomeComponent} from "../environment/environment-home.component"; | ||
13 | +import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component"; | ||
14 | +import {DisplayContentBlockComponent} from "../layout/blocks/display-content/display-content-block.component"; | ||
15 | +import {LinkListBlockComponent} from "../layout/blocks/link-list/link-list-block.component"; | ||
16 | +import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents-block.component"; | ||
17 | +import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; | ||
18 | +import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; | ||
19 | +import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; | ||
20 | +import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component"; | ||
21 | +import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component"; | ||
22 | +import {CustomContentComponent} from "../profile/custom-content/custom-content.component"; | ||
23 | +import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; | ||
24 | + | ||
25 | +import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; | ||
26 | +import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; | ||
27 | + | ||
28 | +import {LoginBlockComponent} from "../layout/blocks/login-block/login-block.component"; | ||
29 | + | ||
30 | +import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; | ||
31 | +import {DateFormat} from "../shared/pipes/date-format.filter"; | ||
32 | + | ||
33 | +import {AuthService} from "../login/auth.service"; | ||
34 | +import {SessionService} from "../login/session.service"; | ||
35 | +import {EnvironmentService} from "./../../lib/ng-noosfero-api/http/environment.service"; | ||
36 | +import {NotificationService} from "../shared/services/notification.service"; | ||
37 | + | ||
38 | +import {BodyStateClassesService} from "./../layout/services/body-state-classes.service"; | ||
39 | + | ||
40 | +import {Navbar} from "../layout/navbar/navbar"; | ||
41 | + | ||
42 | +import {SidebarComponent} from "../layout/sidebar/sidebar.component"; | ||
43 | + | ||
44 | +import {MainBlockComponent} from "../layout/blocks/main/main-block.component"; | ||
45 | +import {HtmlEditorComponent} from "../shared/components/html-editor/html-editor.component"; | ||
46 | +import {PermissionDirective} from "../shared/components/permission/permission.directive"; | ||
47 | +import {SearchComponent} from "../search/search.component"; | ||
48 | +import {SearchFormComponent} from "../search/search-form/search-form.component"; | ||
49 | 49 | ||
50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; | 50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; |
51 | import { NoosferoKnownEvents } from "../known-events"; | 51 | import { NoosferoKnownEvents } from "../known-events"; |
@@ -153,6 +153,18 @@ export class EnvironmentContent { | @@ -153,6 +153,18 @@ export class EnvironmentContent { | ||
153 | } | 153 | } |
154 | }, | 154 | }, |
155 | { | 155 | { |
156 | + url: '/account/signup', | ||
157 | + component: RegisterComponent, | ||
158 | + name: 'main.register', | ||
159 | + views: { | ||
160 | + "content": { | ||
161 | + templateUrl: "app/account/register.html", | ||
162 | + controller: RegisterComponent, | ||
163 | + controllerAs: "vm" | ||
164 | + } | ||
165 | + } | ||
166 | + }, | ||
167 | + { | ||
156 | url: "^/:profile", | 168 | url: "^/:profile", |
157 | abstract: true, | 169 | abstract: true, |
158 | component: ProfileComponent, | 170 | component: ProfileComponent, |
src/languages/en.json
@@ -30,6 +30,19 @@ | @@ -30,6 +30,19 @@ | ||
30 | "auth.form.login_button": "Login", | 30 | "auth.form.login_button": "Login", |
31 | "navbar.content_viewer_actions.new_item": "New Item", | 31 | "navbar.content_viewer_actions.new_item": "New Item", |
32 | "navbar.profile_actions.new_item": "New Item", | 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 | "navbar.content_viewer_actions.new_post": "New Post", | 46 | "navbar.content_viewer_actions.new_post": "New Post", |
34 | "navbar.content_viewer_actions.new_discussion": "New Discussion", | 47 | "navbar.content_viewer_actions.new_discussion": "New Discussion", |
35 | "navbar.profile_actions.new_discussion": "New Discussion", | 48 | "navbar.profile_actions.new_discussion": "New Discussion", |
src/languages/pt.json
@@ -101,4 +101,17 @@ | @@ -101,4 +101,17 @@ | ||
101 | "activities.event.description": "Evento em", | 101 | "activities.event.description": "Evento em", |
102 | "time.at": "às", | 102 | "time.at": "às", |
103 | "date.on": "Em" | 103 | "date.on": "Em" |
104 | + "account.register.welcomeMessage": "Ótimo ter você aqui!", | ||
105 | + "account.register.seeMoreMessage": "Saiba mais ", | ||
106 | + "account.register.informationsMessage": "informações", | ||
107 | + "account.register.firstNameLabel": "Nome", | ||
108 | + "account.register.lastNameLabel": "Sobrenome", | ||
109 | + "account.register.usernameLabel": "Nome de usuário", | ||
110 | + "account.register.emailLabel": "Email", | ||
111 | + "account.register.passwordLabel": "Senha", | ||
112 | + "account.register.passwordConfirmationLabel": "Confirmar senha", | ||
113 | + "account.register.accountCreatingMessage": "Ao criar uma conta, você está concordando com os ", | ||
114 | + "account.register.termsOfUseMessage": "termos de uso", | ||
115 | + "account.register.signupMessage": "Criar Conta", | ||
116 | + "account.register.haveAccountMessage": "Já possui uma conta?" | ||
104 | } | 117 | } |