unsakini 0.0.4.pre.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -27
- data/angular/angular-cli.json +3 -5
- data/{public/unsakini/app → angular/dist}/favicon.ico +0 -0
- data/angular/dist/index.html +14 -0
- data/angular/dist/inline.bundle.js +139 -0
- data/angular/dist/inline.map +1 -0
- data/angular/dist/main.bundle.js +64689 -0
- data/angular/dist/main.map +1 -0
- data/angular/dist/styles.bundle.js +364 -0
- data/angular/dist/styles.map +1 -0
- data/angular/package.json +1 -4
- data/angular/src/app/app.component.html +4 -1
- data/angular/src/app/app.module.ts +7 -8
- data/angular/src/app/app.routes.module.ts +2 -12
- data/angular/src/app/index.ts +0 -2
- data/angular/src/app/registration/registration.component.html +12 -70
- data/angular/src/app/registration/registration.component.spec.ts +11 -8
- data/angular/src/app/registration/registration.component.ts +8 -10
- data/angular/src/environments/environment.prod.ts +1 -2
- data/angular/src/environments/environment.ts +1 -2
- data/angular/src/index.html +1 -1
- data/angular/src/styles.css +1 -0
- data/app/controllers/api/boards_controller.rb +73 -0
- data/app/controllers/api/comments_controller.rb +51 -0
- data/app/controllers/api/posts_controller.rb +58 -0
- data/app/controllers/api/share_board_controller.rb +118 -0
- data/app/controllers/api/users_controller.rb +40 -0
- data/app/controllers/application_controller.rb +2 -2
- data/app/controllers/concerns/board_owner_controller_concern.rb +38 -0
- data/app/controllers/concerns/comment_owner_controller_concern.rb +33 -0
- data/app/controllers/concerns/logged_in_controller_concern.rb +21 -0
- data/app/controllers/concerns/post_owner_controller_concern.rb +36 -0
- data/app/controllers/concerns/serializer_controller_concern.rb +11 -0
- data/app/controllers/user_token_controller.rb +2 -0
- data/app/controllers/web_base_controller.rb +23 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/board.rb +14 -0
- data/app/models/comment.rb +9 -0
- data/app/models/concerns/encryptable_model_concern.rb +96 -0
- data/app/models/post.rb +12 -0
- data/app/models/user.rb +15 -0
- data/app/models/user_board.rb +82 -0
- data/app/serializers/board_serializer.rb +5 -0
- data/app/serializers/{unsakini/comment_serializer.rb → comment_serializer.rb} +3 -6
- data/app/serializers/post_serializer.rb +23 -0
- data/app/serializers/user_board_serializer.rb +11 -0
- data/app/serializers/{unsakini/user_serializer.rb → user_serializer.rb} +2 -5
- data/app/views/{unsakini/web → web_base}/index.html.erb +169 -65
- data/config/routes.rb +10 -10
- data/db/migrate/20161116114222_create_boards.rb +9 -0
- data/db/migrate/{20161116200034_create_unsakini_user_boards.rb → 20161116200034_create_user_boards.rb} +2 -3
- data/db/migrate/{20161118031023_create_unsakini_posts.rb → 20161118031023_create_posts.rb} +2 -2
- data/db/migrate/{20161118100454_create_unsakini_comments.rb → 20161118100454_create_comments.rb} +2 -2
- data/db/migrate/20161118221508_add_encrypted_password_to_user_board.rb +5 -0
- data/db/migrate/20161122211105_create_users.rb +12 -0
- data/db/migrate/20161124102633_add_is_shared_to_boards.rb +5 -0
- data/lib/generators/unsakini/angular/USAGE +8 -0
- data/lib/generators/unsakini/angular/angular_generator.rb +7 -0
- data/lib/generators/unsakini/config/config_generator.rb +1 -3
- data/lib/tasks/unsakini_tasks.rake +37 -6
- data/lib/unsakini/engine.rb +0 -2
- data/lib/unsakini/version.rb +1 -1
- data/public/css/custom.css +1 -5
- data/public/images/logo.svg +619 -0
- data/spec/concerns/models/encryptable_concern.rb +2 -3
- data/spec/controllers/{web_controller_spec.rb → web_base_controller_spec.rb} +3 -4
- data/spec/dummy/config/application.rb +1 -3
- data/spec/dummy/config/environments/development.rb +0 -2
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20161124210219_create_boards.unsakini_engine.rb +10 -0
- data/spec/dummy/db/migrate/20161124210220_create_user_boards.unsakini_engine.rb +12 -0
- data/spec/dummy/db/migrate/20161124210221_create_posts.unsakini_engine.rb +13 -0
- data/spec/dummy/db/migrate/20161124210222_create_comments.unsakini_engine.rb +12 -0
- data/spec/dummy/db/migrate/20161124210223_add_encrypted_password_to_user_board.unsakini_engine.rb +6 -0
- data/spec/dummy/db/migrate/20161124210224_create_users.unsakini_engine.rb +13 -0
- data/spec/dummy/db/migrate/20161124210225_add_is_shared_to_boards.unsakini_engine.rb +6 -0
- data/spec/dummy/db/schema.rb +14 -16
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/app/favicon.ico +0 -0
- data/spec/dummy/public/app/index.html +14 -0
- data/spec/dummy/public/app/inline.bundle.js +139 -0
- data/spec/dummy/public/app/inline.map +1 -0
- data/spec/dummy/public/app/main.bundle.js +64689 -0
- data/spec/dummy/public/app/main.map +1 -0
- data/spec/dummy/public/app/styles.bundle.js +364 -0
- data/spec/dummy/public/app/styles.map +1 -0
- data/spec/dummy/tmp/unsakini-ng2/LICENSE +21 -0
- data/spec/dummy/tmp/unsakini-ng2/README.md +1 -0
- data/spec/dummy/tmp/unsakini-ng2/angular-cli.json +59 -0
- data/spec/dummy/tmp/unsakini-ng2/e2e/app.e2e-spec.ts +14 -0
- data/spec/dummy/tmp/unsakini-ng2/e2e/app.po.ts +11 -0
- data/spec/dummy/tmp/unsakini-ng2/e2e/signup.e2e-spec.ts +28 -0
- data/spec/dummy/tmp/unsakini-ng2/e2e/signup.po.ts +31 -0
- data/spec/dummy/tmp/unsakini-ng2/e2e/tsconfig.json +16 -0
- data/spec/dummy/tmp/unsakini-ng2/karma.conf.js +45 -0
- data/spec/dummy/tmp/unsakini-ng2/package.json +49 -0
- data/spec/dummy/tmp/unsakini-ng2/protractor.conf.js +32 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.css +0 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.html +4 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.spec.ts +47 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.ts +10 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.module.ts +29 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/app.routes.module.ts +29 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/index.ts +2 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.css +0 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.html +14 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.spec.ts +157 -0
- data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.ts +42 -0
- data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.prod.ts +3 -0
- data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.ts +8 -0
- data/spec/dummy/tmp/unsakini-ng2/src/favicon.ico +0 -0
- data/spec/dummy/tmp/unsakini-ng2/src/index.html +14 -0
- data/spec/dummy/tmp/unsakini-ng2/src/main.ts +12 -0
- data/spec/dummy/tmp/unsakini-ng2/src/polyfills.ts +19 -0
- data/spec/dummy/tmp/unsakini-ng2/src/styles.css +1 -0
- data/spec/dummy/tmp/unsakini-ng2/src/test.ts +31 -0
- data/spec/dummy/tmp/unsakini-ng2/src/tsconfig.json +18 -0
- data/spec/dummy/tmp/unsakini-ng2/src/typings.d.ts +2 -0
- data/spec/dummy/tmp/unsakini-ng2/tslint.json +114 -0
- data/spec/dummy/tmp/unsakini-ng2/typings.json +4 -0
- data/spec/factories/boards.rb +1 -1
- data/spec/factories/comments.rb +1 -1
- data/spec/factories/posts.rb +1 -1
- data/spec/factories/user_boards.rb +1 -1
- data/spec/factories/users.rb +1 -1
- data/spec/models/board_spec.rb +2 -2
- data/spec/models/comment_spec.rb +2 -2
- data/spec/models/post_spec.rb +2 -2
- data/spec/models/user_board_spec.rb +19 -19
- data/spec/models/user_spec.rb +1 -1
- data/spec/requests/{boards/boards_crud_spec.rb → api/boards/api_boards_crud_spec.rb} +26 -26
- data/spec/requests/{boards/boards_pagination_spec.rb → api/boards/api_boards_pagination_spec.rb} +7 -7
- data/spec/requests/{boards/private_board_spec.rb → api/boards/api_private_board_spec.rb} +26 -26
- data/spec/requests/{boards/shared_board_spec.rb → api/boards/api_shared_board_spec.rb} +9 -9
- data/spec/requests/{boards/sharing_board_spec.rb → api/boards/api_sharing_board_spec.rb} +13 -13
- data/spec/requests/{comments/comments_pagination_spec.rb → api/comments/api_comments_pagination_spec.rb} +3 -3
- data/spec/requests/{comments/comments_private_board_spec.rb → api/comments/api_comments_private_board_spec.rb} +20 -20
- data/spec/requests/{comments/comments_shared_board_spec.rb → api/comments/api_comments_shared_board_spec.rb} +17 -17
- data/spec/requests/{posts/posts_pagination_spec.rb → api/posts/api_posts_pagination_spec.rb} +3 -3
- data/spec/requests/{posts/posts_private_board_spec.rb → api/posts/api_posts_private_board_spec.rb} +22 -22
- data/spec/requests/{posts/posts_shared_board_spec.rb → api/posts/api_posts_shared_board_spec.rb} +24 -24
- data/spec/requests/{user/user_create_spec.rb → api/user/api_user_create_spec.rb} +23 -19
- data/spec/requests/{user/user_search_spec.rb → api/user/api_user_search_spec.rb} +9 -9
- data/spec/spec_helper.rb +0 -1
- data/spec/support/auth_helper.rb +2 -0
- metadata +202 -135
- data/angular/npm-debug.log +0 -54
- data/angular/src/app/confirm-account/confirm-account.component.ts +0 -27
- data/angular/src/app/confirm-account/confirm-account.html +0 -41
- data/angular/src/app/confirm-account/confirm-account.module.ts +0 -24
- data/angular/src/app/confirm-account/confirm-account.scss +0 -3
- data/angular/src/app/confirm-account/confirm-account.service.ts +0 -27
- data/angular/src/app/confirm-account/index.ts +0 -3
- data/angular/src/app/login/index.ts +0 -3
- data/angular/src/app/login/login.component.ts +0 -40
- data/angular/src/app/login/login.html +0 -43
- data/angular/src/app/login/login.module.ts +0 -27
- data/angular/src/app/login/login.service.ts +0 -48
- data/angular/src/app/registration/index.ts +0 -3
- data/angular/src/app/registration/registration.module.ts +0 -23
- data/angular/src/app/registration/registration.service.ts +0 -46
- data/angular/src/app/registration/registration.services.spec.ts +0 -71
- data/angular/src/app/services/auth-http/auth.http.service.ts +0 -35
- data/angular/src/app/services/auth-http/index.ts +0 -1
- data/angular/src/app/services/http/http.service.spec.ts +0 -205
- data/angular/src/app/services/http/http.service.ts +0 -40
- data/angular/src/app/services/http/index.ts +0 -1
- data/angular/src/app/services/index.ts +0 -3
- data/angular/src/app/services/services.module.ts +0 -33
- data/angular/src/assets/global.scss +0 -3
- data/angular/src/environments/custom.ts +0 -4
- data/app/controllers/concerns/unsakini/board_owner_controller_concern.rb +0 -42
- data/app/controllers/concerns/unsakini/comment_owner_controller_concern.rb +0 -36
- data/app/controllers/concerns/unsakini/logged_in_controller_concern.rb +0 -23
- data/app/controllers/concerns/unsakini/post_owner_controller_concern.rb +0 -38
- data/app/controllers/concerns/unsakini/serializer_controller_concern.rb +0 -13
- data/app/controllers/unsakini/base_controller.rb +0 -6
- data/app/controllers/unsakini/boards_controller.rb +0 -76
- data/app/controllers/unsakini/comments_controller.rb +0 -54
- data/app/controllers/unsakini/posts_controller.rb +0 -61
- data/app/controllers/unsakini/share_board_controller.rb +0 -122
- data/app/controllers/unsakini/user_token_controller.rb +0 -17
- data/app/controllers/unsakini/users_controller.rb +0 -69
- data/app/controllers/unsakini/web_controller.rb +0 -27
- data/app/mailers/unsakini/user_mailer.rb +0 -13
- data/app/models/concerns/unsakini/encryptable_model_concern.rb +0 -97
- data/app/models/unsakini/application_record.rb +0 -7
- data/app/models/unsakini/board.rb +0 -16
- data/app/models/unsakini/comment.rb +0 -12
- data/app/models/unsakini/post.rb +0 -15
- data/app/models/unsakini/user.rb +0 -43
- data/app/models/unsakini/user_board.rb +0 -84
- data/app/models/unsakini.rb +0 -5
- data/app/serializers/unsakini/board_serializer.rb +0 -7
- data/app/serializers/unsakini/post_serializer.rb +0 -26
- data/app/serializers/unsakini/user_board_serializer.rb +0 -14
- data/app/views/unsakini/user_mailer/confirm_account.html.erb +0 -3
- data/db/migrate/20161116114222_create_unsakini_boards.rb +0 -10
- data/db/migrate/20161126145352_create_unsakini_users.rb +0 -15
- data/lib/generators/unsakini/dependencies/USAGE +0 -5
- data/lib/generators/unsakini/dependencies/dependencies_generator.rb +0 -19
- data/public/images/unsakini.svg +0 -56
- data/public/unsakini/app/448c34a56d699c29117adc64c43affeb.woff2 +0 -0
- data/public/unsakini/app/89889688147bd7575d6327160d64e760.svg +0 -288
- data/public/unsakini/app/assets/global.scss +0 -3
- data/public/unsakini/app/e18bbf611f2a2e43afc071aa2f4e1512.ttf +0 -0
- data/public/unsakini/app/f4769f9bdb7466be65088239c12046d1.eot +0 -0
- data/public/unsakini/app/fa2772327f55d8198301fdb8bcfc8158.woff +0 -0
- data/public/unsakini/app/index.html +0 -14
- data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.js +0 -2
- data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.map +0 -1
- data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js +0 -2152
- data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js.gz +0 -0
- data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.map +0 -1
- data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.js +0 -2
- data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.map +0 -1
- data/public/unsakini/app/styles.5dac0e986fce6f8738b300cb558b56a0.bundle.css +0 -8
- data/spec/dummy/config/initializers/knock.rb +0 -59
- data/spec/schema/jwt.json +0 -9
data/angular/npm-debug.log
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
0 info it worked if it ends with ok
|
2
|
-
1 verbose cli [ '/usr/bin/node',
|
3
|
-
1 verbose cli '/usr/bin/npm',
|
4
|
-
1 verbose cli 'run',
|
5
|
-
1 verbose cli 'e2e',
|
6
|
-
1 verbose cli '--',
|
7
|
-
1 verbose cli './protractor.conf.js' ]
|
8
|
-
2 info using npm@4.0.2
|
9
|
-
3 info using node@v6.9.1
|
10
|
-
4 verbose run-script [ 'pree2e', 'e2e', 'poste2e' ]
|
11
|
-
5 info lifecycle angular@0.0.0~pree2e: angular@0.0.0
|
12
|
-
6 verbose lifecycle angular@0.0.0~pree2e: unsafe-perm in lifecycle true
|
13
|
-
7 verbose lifecycle angular@0.0.0~pree2e: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/adones/Projects/UNSAKINI/unsakini/angular/node_modules/.bin:/home/adones/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/bin:/home/adones/.config/composer/vendor/bin
|
14
|
-
8 verbose lifecycle angular@0.0.0~pree2e: CWD: /home/adones/Projects/UNSAKINI/unsakini/angular
|
15
|
-
9 silly lifecycle angular@0.0.0~pree2e: Args: [ '-c', 'webdriver-manager update' ]
|
16
|
-
10 silly lifecycle angular@0.0.0~pree2e: Returned: code: 0 signal: null
|
17
|
-
11 info lifecycle angular@0.0.0~e2e: angular@0.0.0
|
18
|
-
12 verbose lifecycle angular@0.0.0~e2e: unsafe-perm in lifecycle true
|
19
|
-
13 verbose lifecycle angular@0.0.0~e2e: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/adones/Projects/UNSAKINI/unsakini/angular/node_modules/.bin:/home/adones/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/bin:/home/adones/.config/composer/vendor/bin
|
20
|
-
14 verbose lifecycle angular@0.0.0~e2e: CWD: /home/adones/Projects/UNSAKINI/unsakini/angular
|
21
|
-
15 silly lifecycle angular@0.0.0~e2e: Args: [ '-c', 'protractor "./protractor.conf.js"' ]
|
22
|
-
16 silly lifecycle angular@0.0.0~e2e: Returned: code: 1 signal: null
|
23
|
-
17 info lifecycle angular@0.0.0~e2e: Failed to exec e2e script
|
24
|
-
18 verbose stack Error: angular@0.0.0 e2e: `protractor "./protractor.conf.js"`
|
25
|
-
18 verbose stack Exit status 1
|
26
|
-
18 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
|
27
|
-
18 verbose stack at emitTwo (events.js:106:13)
|
28
|
-
18 verbose stack at EventEmitter.emit (events.js:191:7)
|
29
|
-
18 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
|
30
|
-
18 verbose stack at emitTwo (events.js:106:13)
|
31
|
-
18 verbose stack at ChildProcess.emit (events.js:191:7)
|
32
|
-
18 verbose stack at maybeClose (internal/child_process.js:877:16)
|
33
|
-
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
|
34
|
-
19 verbose pkgid angular@0.0.0
|
35
|
-
20 verbose cwd /home/adones/Projects/UNSAKINI/unsakini/angular
|
36
|
-
21 error Linux 4.8.8-2-ARCH
|
37
|
-
22 error argv "/usr/bin/node" "/usr/bin/npm" "run" "e2e" "--" "./protractor.conf.js"
|
38
|
-
23 error node v6.9.1
|
39
|
-
24 error npm v4.0.2
|
40
|
-
25 error code ELIFECYCLE
|
41
|
-
26 error angular@0.0.0 e2e: `protractor "./protractor.conf.js"`
|
42
|
-
26 error Exit status 1
|
43
|
-
27 error Failed at the angular@0.0.0 e2e script 'protractor "./protractor.conf.js"'.
|
44
|
-
27 error Make sure you have the latest version of node.js and npm installed.
|
45
|
-
27 error If you do, this is most likely a problem with the angular package,
|
46
|
-
27 error not with npm itself.
|
47
|
-
27 error Tell the author that this fails on your system:
|
48
|
-
27 error protractor "./protractor.conf.js"
|
49
|
-
27 error You can get information on how to open an issue for this project with:
|
50
|
-
27 error npm bugs angular
|
51
|
-
27 error Or if that isn't available, you can get their info via:
|
52
|
-
27 error npm owner ls angular
|
53
|
-
27 error There is likely additional logging output above.
|
54
|
-
28 verbose exit [ 1, true ]
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import {Component} from '@angular/core';
|
2
|
-
import {Router, Params, ActivatedRoute} from '@angular/router';
|
3
|
-
import {ConfirmAccountService} from './confirm-account.service';
|
4
|
-
import 'rxjs/add/operator/catch';
|
5
|
-
|
6
|
-
@Component({
|
7
|
-
templateUrl: './confirm-account.html',
|
8
|
-
styleUrls: ['./confirm-account.scss']
|
9
|
-
})
|
10
|
-
|
11
|
-
export class ConfirmAccountComponent {
|
12
|
-
confirming = true;
|
13
|
-
confirmed: boolean;
|
14
|
-
constructor(
|
15
|
-
private confirmAccountService: ConfirmAccountService,
|
16
|
-
private router: Router,
|
17
|
-
private route: ActivatedRoute
|
18
|
-
) {
|
19
|
-
this.route.params.forEach((params: Params) => {
|
20
|
-
let token = params['token'];
|
21
|
-
confirmAccountService.confirm(token).subscribe((json) => {
|
22
|
-
this.confirming = false;
|
23
|
-
this.confirmed = json.confirmed;
|
24
|
-
});
|
25
|
-
});
|
26
|
-
}
|
27
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<div class="container">
|
2
|
-
<div class="row">
|
3
|
-
<div class="col-md-4 col-md-offset-4">
|
4
|
-
<h1 class="text-center">
|
5
|
-
<a href="/">
|
6
|
-
<img src="/images/unsakini.svg" width="300px" height="130px">
|
7
|
-
</a>
|
8
|
-
</h1>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<div class="jumbotron" *ngIf="confirming">
|
12
|
-
<h1>
|
13
|
-
Confirming your account. Please wait...
|
14
|
-
</h1>
|
15
|
-
</div>
|
16
|
-
<div class="jumbotron" *ngIf="confirmed && !confirming">
|
17
|
-
<div>
|
18
|
-
<h1>Success!</h1>
|
19
|
-
<hr>
|
20
|
-
<h3>Account activation succedded.</h3>
|
21
|
-
<p>
|
22
|
-
You can now sign in to the <a [routerLink]="['/login']">dashboard</a>.
|
23
|
-
</p>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
<div class="jumbotron" *ngIf="!confirmed && !confirming">
|
27
|
-
<div>
|
28
|
-
<h1>Ouch!</h1>
|
29
|
-
<hr>
|
30
|
-
<h3>
|
31
|
-
Account confirmation failed.
|
32
|
-
</h3>
|
33
|
-
<p>
|
34
|
-
That token is already expired or non-existent.
|
35
|
-
</p>
|
36
|
-
<p>
|
37
|
-
No account yet? <a [routerLink]="['/signup']"><b>Sign up</b></a>.
|
38
|
-
</p>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import {NgModule} from '@angular/core';
|
2
|
-
import {RouterModule} from '@angular/router';
|
3
|
-
import {HttpModule} from '@angular/http';
|
4
|
-
import {CommonModule} from '@angular/common';
|
5
|
-
import {ServicesModule} from '../services';
|
6
|
-
import {ConfirmAccountComponent} from './confirm-account.component';
|
7
|
-
import {ConfirmAccountService} from './confirm-account.service';
|
8
|
-
|
9
|
-
@NgModule({
|
10
|
-
imports: [
|
11
|
-
HttpModule,
|
12
|
-
RouterModule,
|
13
|
-
CommonModule,
|
14
|
-
ServicesModule,
|
15
|
-
],
|
16
|
-
declarations: [
|
17
|
-
ConfirmAccountComponent
|
18
|
-
],
|
19
|
-
providers: [
|
20
|
-
ConfirmAccountService
|
21
|
-
]
|
22
|
-
})
|
23
|
-
|
24
|
-
export class ConfirmAccountModule {}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import {Injectable} from '@angular/core';
|
2
|
-
import {Observable} from 'rxjs/Observable';
|
3
|
-
import 'rxjs/add/operator/map';
|
4
|
-
import 'rxjs/add/operator/catch';
|
5
|
-
import {HttpService} from '../services';
|
6
|
-
|
7
|
-
@Injectable()
|
8
|
-
|
9
|
-
export class ConfirmAccountService {
|
10
|
-
constructor(private http: HttpService) { }
|
11
|
-
|
12
|
-
confirm (token: string): Observable<any> {
|
13
|
-
return this.http.get(`/user/confirm/${token}`).map((res) => {
|
14
|
-
console.log(res)
|
15
|
-
if (res.ok) {
|
16
|
-
return {confirmed: true}
|
17
|
-
} else {
|
18
|
-
return {confirmed: false}
|
19
|
-
}
|
20
|
-
}).catch(this.catchError);
|
21
|
-
}
|
22
|
-
|
23
|
-
private catchError(res) {
|
24
|
-
return Observable.of({confirmed: false});
|
25
|
-
}
|
26
|
-
|
27
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
|
2
|
-
import {Component} from '@angular/core';
|
3
|
-
import {Router} from '@angular/router';
|
4
|
-
import {ICredentials, LoginService} from './login.service';
|
5
|
-
|
6
|
-
|
7
|
-
@Component({
|
8
|
-
templateUrl: './login.html'
|
9
|
-
})
|
10
|
-
export class LoginComponent {
|
11
|
-
|
12
|
-
creds: ICredentials;
|
13
|
-
error: string;
|
14
|
-
success: string;
|
15
|
-
|
16
|
-
constructor(
|
17
|
-
private loginService: LoginService,
|
18
|
-
private router: Router
|
19
|
-
) {
|
20
|
-
this.creds = {email: '', password: ''};
|
21
|
-
}
|
22
|
-
|
23
|
-
doLogin (e) {
|
24
|
-
e.stopPropagation();
|
25
|
-
this.error = null;
|
26
|
-
this.loginService.login(this.creds)
|
27
|
-
.subscribe(
|
28
|
-
(json) => {
|
29
|
-
this.success = 'Login successful. Redirecting...';
|
30
|
-
window.localStorage.setItem('auth_token', json.token);
|
31
|
-
// this.router.navigate(['/dashboard']);
|
32
|
-
// window.location.assign('/dashboard');
|
33
|
-
},
|
34
|
-
(e) => {
|
35
|
-
this.error = e;
|
36
|
-
}
|
37
|
-
);
|
38
|
-
return false;
|
39
|
-
}
|
40
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<div class="container home-forms">
|
2
|
-
<div class="row">
|
3
|
-
<div class="col-md-4 col-md-offset-4">
|
4
|
-
<h1 class="text-center">
|
5
|
-
<a href="/">
|
6
|
-
<img src="/images/unsakini.svg" width="300px" height="130px">
|
7
|
-
</a>
|
8
|
-
</h1>
|
9
|
-
<hr>
|
10
|
-
<p class="lead text-center">
|
11
|
-
Sign In
|
12
|
-
</p>
|
13
|
-
<form #loginForm="ngForm">
|
14
|
-
<div *ngIf="error" class="alert alert-danger">
|
15
|
-
{{error}}
|
16
|
-
</div>
|
17
|
-
<div class="form-group">
|
18
|
-
<label for="email">Email</label>
|
19
|
-
<input type="email" class="form-control" id="email" placeholder="Email" required [(ngModel)]="creds.email" name="email" #email="ngModel">
|
20
|
-
</div>
|
21
|
-
<div [hidden]="email.valid || email.pristine" class="alert alert-danger">
|
22
|
-
Email is required
|
23
|
-
</div>
|
24
|
-
<label for="password">Password</label>
|
25
|
-
<input type="password" class="form-control" id="password" placeholder="Password" required [(ngModel)]="creds.password" name="password" #password="ngModel">
|
26
|
-
<div [hidden]="password.valid || password.pristine" class="alert alert-danger">
|
27
|
-
Password is required
|
28
|
-
</div>
|
29
|
-
<div class="form-group" style="margin-top: 20px;">
|
30
|
-
<button (click)="doLogin($event)" type="submit" class="btn btn-primary" [disabled]="!loginForm.form.valid || submitting">
|
31
|
-
<span *ngIf="!submitting">Sign In</span>
|
32
|
-
<span *ngIf="submitting">Signing in...</span>
|
33
|
-
</button>
|
34
|
-
</div>
|
35
|
-
</form>
|
36
|
-
<hr>
|
37
|
-
<p>
|
38
|
-
Don't have an account? <a [routerLink]="['/signup']">Create Account</a>
|
39
|
-
</p>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
</div>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { NgModule } from '@angular/core';
|
2
|
-
import { RouterModule } from '@angular/router';
|
3
|
-
import { BrowserModule } from '@angular/platform-browser';
|
4
|
-
import { HttpModule } from '@angular/http';
|
5
|
-
import { FormsModule } from '@angular/forms';
|
6
|
-
import { ServicesModule } from '../services'
|
7
|
-
|
8
|
-
import {LoginComponent} from './login.component';
|
9
|
-
import {LoginService} from './login.service';
|
10
|
-
|
11
|
-
@NgModule({
|
12
|
-
imports: [
|
13
|
-
BrowserModule,
|
14
|
-
HttpModule,
|
15
|
-
FormsModule,
|
16
|
-
RouterModule,
|
17
|
-
ServicesModule,
|
18
|
-
],
|
19
|
-
declarations: [
|
20
|
-
LoginComponent,
|
21
|
-
],
|
22
|
-
providers: [
|
23
|
-
LoginService
|
24
|
-
]
|
25
|
-
})
|
26
|
-
|
27
|
-
export class LoginModule {}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import {Injectable} from '@angular/core';
|
2
|
-
import {Response} from '@angular/http';
|
3
|
-
import { HttpService } from '../services/http';
|
4
|
-
import {Observable} from 'rxjs/Observable';
|
5
|
-
import 'rxjs/add/operator/map';
|
6
|
-
import 'rxjs/add/operator/catch';
|
7
|
-
|
8
|
-
export interface ICredentials {
|
9
|
-
email: string;
|
10
|
-
password: string;
|
11
|
-
}
|
12
|
-
|
13
|
-
export interface IAuthUser {
|
14
|
-
id: number;
|
15
|
-
name: string;
|
16
|
-
email: string;
|
17
|
-
}
|
18
|
-
|
19
|
-
@Injectable()
|
20
|
-
export class LoginService {
|
21
|
-
|
22
|
-
constructor (
|
23
|
-
private http: HttpService
|
24
|
-
) {}
|
25
|
-
|
26
|
-
login (creds: ICredentials) {
|
27
|
-
return this.http.post('/user_token', {auth: creds}).map(
|
28
|
-
(res) => {
|
29
|
-
return res.json();
|
30
|
-
}
|
31
|
-
)
|
32
|
-
.catch(this.loginFailedHandler(this));
|
33
|
-
}
|
34
|
-
|
35
|
-
private loginFailedHandler (self: LoginService) {
|
36
|
-
return (res: Response) => {
|
37
|
-
let error_message = res.toString();
|
38
|
-
|
39
|
-
if (res.status === 404 && res.text.length === 0)
|
40
|
-
error_message = `Invalid email and password combination.`
|
41
|
-
if (res.status === 401)
|
42
|
-
error_message = res.json().message;
|
43
|
-
|
44
|
-
return Observable.throw(error_message);
|
45
|
-
|
46
|
-
};
|
47
|
-
}
|
48
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { NgModule } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
import { FormsModule } from '@angular/forms';
|
4
|
-
import { RouterModule } from '@angular/router';
|
5
|
-
import { ServicesModule } from '../services'
|
6
|
-
import { RegistrationComponent } from './registration.component';
|
7
|
-
import { RegistrationService } from './registration.service';
|
8
|
-
|
9
|
-
@NgModule({
|
10
|
-
imports: [
|
11
|
-
ServicesModule,
|
12
|
-
RouterModule,
|
13
|
-
FormsModule,
|
14
|
-
CommonModule
|
15
|
-
],
|
16
|
-
declarations: [
|
17
|
-
RegistrationComponent
|
18
|
-
],
|
19
|
-
providers: [
|
20
|
-
RegistrationService
|
21
|
-
]
|
22
|
-
})
|
23
|
-
export class RegistrationModule { }
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import { Observable } from 'rxjs/Observable';
|
3
|
-
import { Response } from '@angular/http';
|
4
|
-
import 'rxjs/add/observable/of';
|
5
|
-
import 'rxjs/add/observable/throw';
|
6
|
-
import 'rxjs/add/operator/map';
|
7
|
-
import 'rxjs/add/operator/catch';
|
8
|
-
import { HttpService } from '../services/http/http.service';
|
9
|
-
|
10
|
-
export interface IAccount {
|
11
|
-
name: string
|
12
|
-
email: string
|
13
|
-
password: string
|
14
|
-
password_confirmation: string
|
15
|
-
}
|
16
|
-
|
17
|
-
@Injectable()
|
18
|
-
export class RegistrationService {
|
19
|
-
|
20
|
-
constructor(private http: HttpService) {}
|
21
|
-
|
22
|
-
registerAccount(acct: IAccount) {
|
23
|
-
return this.http.post('/user', acct)
|
24
|
-
.map(this.extractData)
|
25
|
-
.catch(this.handleError)
|
26
|
-
}
|
27
|
-
|
28
|
-
private extractData (res) {
|
29
|
-
return res.json()
|
30
|
-
}
|
31
|
-
|
32
|
-
private handleError(err: Response) {
|
33
|
-
console.log(err)
|
34
|
-
let errors: any;
|
35
|
-
try {
|
36
|
-
errors = err.json();
|
37
|
-
errors['name'] = errors['name'] || []
|
38
|
-
errors['email'] = errors['email'] || []
|
39
|
-
errors['password'] = errors['password'] || []
|
40
|
-
errors['password_confirmation'] = errors['password_confirmation'] || []
|
41
|
-
} catch (e) {
|
42
|
-
errors = [err.text]
|
43
|
-
}
|
44
|
-
return Observable.throw(errors)
|
45
|
-
}
|
46
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
|
2
|
-
import { inject, async, ComponentFixture, TestBed } from '@angular/core/testing';
|
3
|
-
import { MockBackend, MockConnection } from '@angular/http/testing';
|
4
|
-
import { Http, BaseRequestOptions, Response, ResponseOptions } from '@angular/http';
|
5
|
-
|
6
|
-
import { HttpService } from '..';
|
7
|
-
import { RegistrationService, IAccount } from '.'
|
8
|
-
|
9
|
-
describe('RegistrationService', () => {
|
10
|
-
|
11
|
-
beforeEach(() => {
|
12
|
-
TestBed.configureTestingModule({
|
13
|
-
providers: [
|
14
|
-
HttpService,
|
15
|
-
RegistrationService,
|
16
|
-
BaseRequestOptions,
|
17
|
-
MockBackend,
|
18
|
-
{
|
19
|
-
provide: Http,
|
20
|
-
useFactory: (backend, defaultOptions) => { return new Http(backend, defaultOptions) },
|
21
|
-
deps: [MockBackend, BaseRequestOptions]
|
22
|
-
},
|
23
|
-
]
|
24
|
-
});
|
25
|
-
});
|
26
|
-
|
27
|
-
it(`handles error`, inject([MockBackend, RegistrationService], (backend: MockBackend, service: RegistrationService) => {
|
28
|
-
let errors = ['name is required']
|
29
|
-
let mockResponse = new Response(new ResponseOptions({
|
30
|
-
status: 422,
|
31
|
-
body: errors
|
32
|
-
}))
|
33
|
-
|
34
|
-
backend.connections.subscribe(c => c.mockError(mockResponse));
|
35
|
-
|
36
|
-
let acct: IAccount = {
|
37
|
-
name: '',
|
38
|
-
email: '',
|
39
|
-
password: '',
|
40
|
-
password_confirmation: ''
|
41
|
-
}
|
42
|
-
|
43
|
-
service.registerAccount(acct).subscribe((res: Response) => {}, (err: Response) => {
|
44
|
-
expect(err).toEqual(errors)
|
45
|
-
});
|
46
|
-
|
47
|
-
}))
|
48
|
-
|
49
|
-
it(`handles success`, inject([MockBackend, RegistrationService], (backend: MockBackend, service: RegistrationService) => {
|
50
|
-
|
51
|
-
let acct: IAccount = {
|
52
|
-
name: '',
|
53
|
-
email: '',
|
54
|
-
password: '',
|
55
|
-
password_confirmation: ''
|
56
|
-
}
|
57
|
-
|
58
|
-
let mockResponse = new Response(new ResponseOptions({
|
59
|
-
status: 200,
|
60
|
-
body: acct
|
61
|
-
}))
|
62
|
-
|
63
|
-
backend.connections.subscribe(c => c.mockRespond(mockResponse));
|
64
|
-
|
65
|
-
service.registerAccount(acct).subscribe((res: Response) => {
|
66
|
-
expect(res).toEqual(acct)
|
67
|
-
});
|
68
|
-
|
69
|
-
}))
|
70
|
-
|
71
|
-
});
|
@@ -1,35 +0,0 @@
|
|
1
|
-
|
2
|
-
import { environment } from '../../../environments/environment';
|
3
|
-
import {HttpService} from '../http';
|
4
|
-
import {Injectable} from '@angular/core';
|
5
|
-
import {Http, XHRBackend, RequestOptions, Request, RequestOptionsArgs, Response, Headers} from '@angular/http';
|
6
|
-
import {Observable} from 'rxjs/Observable';
|
7
|
-
import 'rxjs/add/operator/catch';
|
8
|
-
import 'rxjs/add/operator/map';
|
9
|
-
|
10
|
-
@Injectable()
|
11
|
-
export class AuthHttpService extends HttpService {
|
12
|
-
|
13
|
-
base_url = environment.api_base_url;
|
14
|
-
|
15
|
-
constructor (backend: XHRBackend, options: RequestOptions) {
|
16
|
-
super(backend, options);
|
17
|
-
}
|
18
|
-
|
19
|
-
request(url: string|Request, options?: RequestOptionsArgs): Observable<Response> {
|
20
|
-
if (typeof url === 'string') {
|
21
|
-
if (!options) {
|
22
|
-
options = {headers: new Headers()};
|
23
|
-
}
|
24
|
-
options.headers.set('Authorization', `Bearer ${this.getAuthToken()}`);
|
25
|
-
} else {
|
26
|
-
url.headers.set('Authorization', `Bearer ${this.getAuthToken()}`);
|
27
|
-
}
|
28
|
-
return super.request(url, options);
|
29
|
-
}
|
30
|
-
|
31
|
-
getAuthToken () {
|
32
|
-
return localStorage.getItem('auth_token');
|
33
|
-
}
|
34
|
-
|
35
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './auth.http.service';
|