unsakini 0.0.4.2 → 0.0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -0
  3. data/angular/angular-cli.json +5 -3
  4. data/angular/npm-debug.log +54 -0
  5. data/angular/package.json +4 -1
  6. data/angular/src/app/app.component.html +1 -4
  7. data/angular/src/app/app.module.ts +8 -7
  8. data/angular/src/app/app.routes.module.ts +12 -2
  9. data/angular/src/app/confirm-account/confirm-account.component.ts +27 -0
  10. data/angular/src/app/confirm-account/confirm-account.html +41 -0
  11. data/angular/src/app/confirm-account/confirm-account.module.ts +24 -0
  12. data/angular/src/app/confirm-account/confirm-account.scss +3 -0
  13. data/angular/src/app/confirm-account/confirm-account.service.ts +27 -0
  14. data/angular/src/app/confirm-account/index.ts +3 -0
  15. data/angular/src/app/index.ts +2 -0
  16. data/angular/src/app/login/index.ts +3 -0
  17. data/angular/src/app/login/login.component.ts +40 -0
  18. data/angular/src/app/login/login.html +43 -0
  19. data/angular/src/app/login/login.module.ts +27 -0
  20. data/angular/src/app/login/login.service.ts +48 -0
  21. data/angular/src/app/registration/index.ts +3 -0
  22. data/angular/src/app/registration/registration.component.html +70 -12
  23. data/angular/src/app/registration/registration.component.spec.ts +8 -11
  24. data/angular/src/app/registration/registration.component.ts +10 -8
  25. data/angular/src/app/registration/registration.module.ts +23 -0
  26. data/angular/src/app/registration/registration.service.ts +46 -0
  27. data/angular/src/app/registration/registration.services.spec.ts +71 -0
  28. data/angular/src/app/services/auth-http/auth.http.service.ts +35 -0
  29. data/angular/src/app/services/auth-http/index.ts +1 -0
  30. data/angular/src/app/services/http/http.service.spec.ts +205 -0
  31. data/angular/src/app/services/http/http.service.ts +40 -0
  32. data/angular/src/app/services/http/index.ts +1 -0
  33. data/angular/src/app/services/index.ts +3 -0
  34. data/angular/src/app/services/services.module.ts +33 -0
  35. data/angular/src/assets/global.scss +3 -0
  36. data/angular/src/environments/custom.ts +4 -0
  37. data/angular/src/environments/environment.prod.ts +2 -1
  38. data/angular/src/environments/environment.ts +2 -1
  39. data/angular/src/index.html +1 -1
  40. data/app/controllers/application_controller.rb +2 -2
  41. data/app/controllers/concerns/unsakini/board_owner_controller_concern.rb +42 -0
  42. data/app/controllers/concerns/unsakini/comment_owner_controller_concern.rb +36 -0
  43. data/app/controllers/concerns/unsakini/logged_in_controller_concern.rb +23 -0
  44. data/app/controllers/concerns/unsakini/post_owner_controller_concern.rb +38 -0
  45. data/app/controllers/concerns/unsakini/serializer_controller_concern.rb +13 -0
  46. data/app/controllers/unsakini/base_controller.rb +6 -0
  47. data/app/controllers/unsakini/boards_controller.rb +76 -0
  48. data/app/controllers/unsakini/comments_controller.rb +54 -0
  49. data/app/controllers/unsakini/posts_controller.rb +61 -0
  50. data/app/controllers/unsakini/share_board_controller.rb +122 -0
  51. data/app/controllers/unsakini/user_token_controller.rb +17 -0
  52. data/app/controllers/unsakini/users_controller.rb +69 -0
  53. data/app/controllers/unsakini/web_controller.rb +27 -0
  54. data/app/mailers/unsakini/user_mailer.rb +13 -0
  55. data/app/models/concerns/unsakini/encryptable_model_concern.rb +97 -0
  56. data/app/models/unsakini/application_record.rb +7 -0
  57. data/app/models/unsakini/board.rb +16 -0
  58. data/app/models/unsakini/comment.rb +12 -0
  59. data/app/models/unsakini/post.rb +15 -0
  60. data/app/models/unsakini/user.rb +43 -0
  61. data/app/models/unsakini/user_board.rb +84 -0
  62. data/app/models/unsakini.rb +5 -0
  63. data/app/serializers/unsakini/board_serializer.rb +7 -0
  64. data/app/serializers/{comment_serializer.rb → unsakini/comment_serializer.rb} +6 -3
  65. data/app/serializers/unsakini/post_serializer.rb +26 -0
  66. data/app/serializers/unsakini/user_board_serializer.rb +14 -0
  67. data/app/serializers/{user_serializer.rb → unsakini/user_serializer.rb} +5 -2
  68. data/app/views/unsakini/user_mailer/confirm_account.html.erb +3 -0
  69. data/app/views/{web_base → unsakini/web}/index.html.erb +9 -7
  70. data/config/routes.rb +10 -10
  71. data/db/migrate/20161116114222_create_unsakini_boards.rb +10 -0
  72. data/db/migrate/{20161116200034_create_user_boards.rb → 20161116200034_create_unsakini_user_boards.rb} +3 -2
  73. data/db/migrate/{20161118031023_create_posts.rb → 20161118031023_create_unsakini_posts.rb} +2 -2
  74. data/db/migrate/{20161118100454_create_comments.rb → 20161118100454_create_unsakini_comments.rb} +2 -2
  75. data/db/migrate/20161126145352_create_unsakini_users.rb +15 -0
  76. data/lib/generators/unsakini/config/config_generator.rb +3 -1
  77. data/lib/generators/unsakini/dependencies/USAGE +5 -0
  78. data/lib/generators/unsakini/dependencies/dependencies_generator.rb +19 -0
  79. data/lib/tasks/unsakini_tasks.rake +6 -37
  80. data/lib/unsakini/engine.rb +2 -0
  81. data/lib/unsakini/version.rb +1 -1
  82. data/public/images/unsakini.svg +56 -0
  83. data/public/unsakini/app/448c34a56d699c29117adc64c43affeb.woff2 +0 -0
  84. data/public/unsakini/app/89889688147bd7575d6327160d64e760.svg +288 -0
  85. data/public/unsakini/app/assets/global.scss +3 -0
  86. data/public/unsakini/app/e18bbf611f2a2e43afc071aa2f4e1512.ttf +0 -0
  87. data/public/unsakini/app/f4769f9bdb7466be65088239c12046d1.eot +0 -0
  88. data/public/unsakini/app/fa2772327f55d8198301fdb8bcfc8158.woff +0 -0
  89. data/{angular/dist → public/unsakini/app}/favicon.ico +0 -0
  90. data/public/unsakini/app/index.html +14 -0
  91. data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.js +2 -0
  92. data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.map +1 -0
  93. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js +2152 -0
  94. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js.gz +0 -0
  95. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.map +1 -0
  96. data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.js +2 -0
  97. data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.map +1 -0
  98. data/public/unsakini/app/styles.5dac0e986fce6f8738b300cb558b56a0.bundle.css +8 -0
  99. data/spec/concerns/models/encryptable_concern.rb +3 -2
  100. data/spec/controllers/{web_base_controller_spec.rb → web_controller_spec.rb} +4 -3
  101. data/spec/dummy/config/application.rb +3 -1
  102. data/spec/dummy/config/environments/development.rb +2 -0
  103. data/spec/dummy/config/initializers/knock.rb +59 -0
  104. data/spec/dummy/db/schema.rb +16 -14
  105. data/spec/dummy/db/test.sqlite3 +0 -0
  106. data/spec/factories/boards.rb +1 -1
  107. data/spec/factories/comments.rb +1 -1
  108. data/spec/factories/posts.rb +1 -1
  109. data/spec/factories/user_boards.rb +1 -1
  110. data/spec/factories/users.rb +1 -1
  111. data/spec/models/board_spec.rb +2 -2
  112. data/spec/models/comment_spec.rb +2 -2
  113. data/spec/models/post_spec.rb +2 -2
  114. data/spec/models/user_board_spec.rb +19 -19
  115. data/spec/models/user_spec.rb +1 -1
  116. data/spec/requests/{api/boards/api_boards_crud_spec.rb → boards/boards_crud_spec.rb} +26 -26
  117. data/spec/requests/{api/boards/api_boards_pagination_spec.rb → boards/boards_pagination_spec.rb} +7 -7
  118. data/spec/requests/{api/boards/api_private_board_spec.rb → boards/private_board_spec.rb} +26 -26
  119. data/spec/requests/{api/boards/api_shared_board_spec.rb → boards/shared_board_spec.rb} +9 -9
  120. data/spec/requests/{api/boards/api_sharing_board_spec.rb → boards/sharing_board_spec.rb} +13 -13
  121. data/spec/requests/{api/comments/api_comments_pagination_spec.rb → comments/comments_pagination_spec.rb} +3 -3
  122. data/spec/requests/{api/comments/api_comments_private_board_spec.rb → comments/comments_private_board_spec.rb} +20 -20
  123. data/spec/requests/{api/comments/api_comments_shared_board_spec.rb → comments/comments_shared_board_spec.rb} +17 -17
  124. data/spec/requests/{api/posts/api_posts_pagination_spec.rb → posts/posts_pagination_spec.rb} +3 -3
  125. data/spec/requests/{api/posts/api_posts_private_board_spec.rb → posts/posts_private_board_spec.rb} +22 -22
  126. data/spec/requests/{api/posts/api_posts_shared_board_spec.rb → posts/posts_shared_board_spec.rb} +24 -24
  127. data/spec/requests/{api/user/api_user_create_spec.rb → user/user_create_spec.rb} +19 -23
  128. data/spec/requests/{api/user/api_user_search_spec.rb → user/user_search_spec.rb} +9 -9
  129. data/spec/schema/jwt.json +9 -0
  130. data/spec/spec_helper.rb +1 -0
  131. data/spec/support/auth_helper.rb +0 -2
  132. metadata +133 -200
  133. data/angular/dist/index.html +0 -14
  134. data/angular/dist/inline.bundle.js +0 -139
  135. data/angular/dist/inline.map +0 -1
  136. data/angular/dist/main.bundle.js +0 -64689
  137. data/angular/dist/main.map +0 -1
  138. data/angular/dist/styles.bundle.js +0 -364
  139. data/angular/dist/styles.map +0 -1
  140. data/angular/src/styles.css +0 -1
  141. data/app/controllers/api/boards_controller.rb +0 -73
  142. data/app/controllers/api/comments_controller.rb +0 -51
  143. data/app/controllers/api/posts_controller.rb +0 -58
  144. data/app/controllers/api/share_board_controller.rb +0 -118
  145. data/app/controllers/api/users_controller.rb +0 -40
  146. data/app/controllers/concerns/board_owner_controller_concern.rb +0 -38
  147. data/app/controllers/concerns/comment_owner_controller_concern.rb +0 -33
  148. data/app/controllers/concerns/logged_in_controller_concern.rb +0 -21
  149. data/app/controllers/concerns/post_owner_controller_concern.rb +0 -36
  150. data/app/controllers/concerns/serializer_controller_concern.rb +0 -11
  151. data/app/controllers/user_token_controller.rb +0 -2
  152. data/app/controllers/web_base_controller.rb +0 -23
  153. data/app/models/application_record.rb +0 -5
  154. data/app/models/board.rb +0 -14
  155. data/app/models/comment.rb +0 -9
  156. data/app/models/concerns/encryptable_model_concern.rb +0 -96
  157. data/app/models/post.rb +0 -12
  158. data/app/models/user.rb +0 -15
  159. data/app/models/user_board.rb +0 -82
  160. data/app/serializers/board_serializer.rb +0 -5
  161. data/app/serializers/post_serializer.rb +0 -23
  162. data/app/serializers/user_board_serializer.rb +0 -11
  163. data/db/migrate/20161116114222_create_boards.rb +0 -9
  164. data/db/migrate/20161118221508_add_encrypted_password_to_user_board.rb +0 -5
  165. data/db/migrate/20161122211105_create_users.rb +0 -12
  166. data/db/migrate/20161124102633_add_is_shared_to_boards.rb +0 -5
  167. data/lib/generators/unsakini/angular/USAGE +0 -8
  168. data/lib/generators/unsakini/angular/angular_generator.rb +0 -7
  169. data/public/images/logo.svg +0 -619
  170. data/spec/dummy/config/initializers/assets.rb +0 -11
  171. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
  172. data/spec/dummy/config/initializers/session_store.rb +0 -3
  173. data/spec/dummy/db/development.sqlite3 +0 -0
  174. data/spec/dummy/db/migrate/20161124210219_create_boards.unsakini_engine.rb +0 -10
  175. data/spec/dummy/db/migrate/20161124210220_create_user_boards.unsakini_engine.rb +0 -12
  176. data/spec/dummy/db/migrate/20161124210221_create_posts.unsakini_engine.rb +0 -13
  177. data/spec/dummy/db/migrate/20161124210222_create_comments.unsakini_engine.rb +0 -12
  178. data/spec/dummy/db/migrate/20161124210223_add_encrypted_password_to_user_board.unsakini_engine.rb +0 -6
  179. data/spec/dummy/db/migrate/20161124210224_create_users.unsakini_engine.rb +0 -13
  180. data/spec/dummy/db/migrate/20161124210225_add_is_shared_to_boards.unsakini_engine.rb +0 -6
  181. data/spec/dummy/public/app/favicon.ico +0 -0
  182. data/spec/dummy/public/app/index.html +0 -14
  183. data/spec/dummy/public/app/inline.bundle.js +0 -139
  184. data/spec/dummy/public/app/inline.map +0 -1
  185. data/spec/dummy/public/app/main.bundle.js +0 -64689
  186. data/spec/dummy/public/app/main.map +0 -1
  187. data/spec/dummy/public/app/styles.bundle.js +0 -364
  188. data/spec/dummy/public/app/styles.map +0 -1
  189. data/spec/dummy/tmp/unsakini-ng2/LICENSE +0 -21
  190. data/spec/dummy/tmp/unsakini-ng2/README.md +0 -1
  191. data/spec/dummy/tmp/unsakini-ng2/angular-cli.json +0 -59
  192. data/spec/dummy/tmp/unsakini-ng2/e2e/app.e2e-spec.ts +0 -14
  193. data/spec/dummy/tmp/unsakini-ng2/e2e/app.po.ts +0 -11
  194. data/spec/dummy/tmp/unsakini-ng2/e2e/signup.e2e-spec.ts +0 -28
  195. data/spec/dummy/tmp/unsakini-ng2/e2e/signup.po.ts +0 -31
  196. data/spec/dummy/tmp/unsakini-ng2/e2e/tsconfig.json +0 -16
  197. data/spec/dummy/tmp/unsakini-ng2/karma.conf.js +0 -45
  198. data/spec/dummy/tmp/unsakini-ng2/package.json +0 -49
  199. data/spec/dummy/tmp/unsakini-ng2/protractor.conf.js +0 -32
  200. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.css +0 -0
  201. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.html +0 -4
  202. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.spec.ts +0 -47
  203. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.ts +0 -10
  204. data/spec/dummy/tmp/unsakini-ng2/src/app/app.module.ts +0 -29
  205. data/spec/dummy/tmp/unsakini-ng2/src/app/app.routes.module.ts +0 -29
  206. data/spec/dummy/tmp/unsakini-ng2/src/app/index.ts +0 -2
  207. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.css +0 -0
  208. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.html +0 -14
  209. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.spec.ts +0 -157
  210. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.ts +0 -42
  211. data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.prod.ts +0 -3
  212. data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.ts +0 -8
  213. data/spec/dummy/tmp/unsakini-ng2/src/favicon.ico +0 -0
  214. data/spec/dummy/tmp/unsakini-ng2/src/index.html +0 -14
  215. data/spec/dummy/tmp/unsakini-ng2/src/main.ts +0 -12
  216. data/spec/dummy/tmp/unsakini-ng2/src/polyfills.ts +0 -19
  217. data/spec/dummy/tmp/unsakini-ng2/src/styles.css +0 -1
  218. data/spec/dummy/tmp/unsakini-ng2/src/test.ts +0 -31
  219. data/spec/dummy/tmp/unsakini-ng2/src/tsconfig.json +0 -18
  220. data/spec/dummy/tmp/unsakini-ng2/src/typings.d.ts +0 -2
  221. data/spec/dummy/tmp/unsakini-ng2/tslint.json +0 -114
  222. data/spec/dummy/tmp/unsakini-ng2/typings.json +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54053e7e5b61b8cfbf49bdeb46789a0aa05bf63c
4
- data.tar.gz: 6ed74baa24a16312b7767f27d5f7d831c6e24dea
3
+ metadata.gz: a0d780cebdb7dd795bdcb575419e297c3b930e5b
4
+ data.tar.gz: c6ce2373bf39b51a6b94a6481665b4395e3cbe63
5
5
  SHA512:
6
- metadata.gz: 424a75de3e27bebb05b989694cd7569702bb5a275aa3cb39fd1d554809dce1fe9368a001e70eddf74db298162f889f28bd8a7b48eec02f3301eb541531e85d6a
7
- data.tar.gz: 087b2e3fd72a467c7f0dce94e845e78124e912c00de5de262b5b3ba5b174f1d4b0261e827df5ffb867d979b9f4e1de10767cde789a4f72e486c3db51151dc868
6
+ metadata.gz: daf67dd36409c1c044064d2771ee780299b0e4231c404d9c6bfa05b0311ac5ca81cc3898a2c6948011a21a52376796301ac57f6be03bd94666d82fe53c9f7fc7
7
+ data.tar.gz: 6646d882f54f409179ead7f8b240697b42d45a781b23b6edac7ab31079f127f7d5e7661929b3d178d8b3b5c8d2436752a89b0aed2ca67fde6a8d160cd06931d1
data/README.md CHANGED
@@ -48,6 +48,32 @@ Bundle install and initialize the application
48
48
  $ bundle install
49
49
  $ rake unsakini:install
50
50
  ```
51
+ The `rake unsakini:install` command is just a super set of the following commands:
52
+ ```
53
+ $ rails generate unsakini:config # generates config/initializers/unsakini.rb
54
+ $ rails generate unsakini:dependencies # add dependencies to Gemfile
55
+ $ rake unsakini_engine:install:migrations # copy the engine migrations to db/migrations directory
56
+ $ rake db:migrate # runs the migration files
57
+ ```
58
+
59
+ These dependencies will be added to your Gemfile
60
+ ```bash
61
+ gem "active_model_serializers"
62
+ gem "rack-cors"
63
+ gem "kaminari"
64
+ gem "api-pagination"
65
+ # As of Nov 28, 2016: waiting for my PR to be merged
66
+ # https://github.com/nsarno/knock/pull/126
67
+ gem 'knock', git: 'https://github.com/adonespitogo/knock'
68
+
69
+ ```
70
+
71
+ Install the newly added dependencies
72
+
73
+ **Note:** You might want to review your Gemfile first
74
+ ```
75
+ $ bundle install
76
+ ```
51
77
 
52
78
  Run local rails server
53
79
  ```
@@ -6,7 +6,7 @@
6
6
  "apps": [
7
7
  {
8
8
  "root": "src",
9
- "outDir": "dist",
9
+ "outDir": "../public/unsakini/app/",
10
10
  "assets": [
11
11
  "assets",
12
12
  "favicon.ico"
@@ -18,13 +18,15 @@
18
18
  "prefix": "app",
19
19
  "mobile": false,
20
20
  "styles": [
21
- "styles.css"
21
+ "../node_modules/bootstrap/dist/css/bootstrap.css",
22
+ "assets/global.scss"
22
23
  ],
23
24
  "scripts": [],
24
25
  "environments": {
25
26
  "source": "environments/environment.ts",
26
27
  "dev": "environments/environment.ts",
27
- "prod": "environments/environment.prod.ts"
28
+ "prod": "environments/environment.prod.ts",
29
+ "custom": "environments/custom.ts"
28
30
  }
29
31
  }
30
32
  ],
@@ -0,0 +1,54 @@
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 ]
data/angular/package.json CHANGED
@@ -21,8 +21,11 @@
21
21
  "@angular/platform-browser": "^2.1.0",
22
22
  "@angular/platform-browser-dynamic": "^2.1.0",
23
23
  "@angular/router": "^3.1.0",
24
- "angular2-token": "^0.2.0-beta.3",
24
+ "angular2-jwt": "^0.1.25",
25
+ "bootstrap": "^3.3.7",
26
+ "bootstrap-sass": "^3.3.7",
25
27
  "core-js": "^2.4.1",
28
+ "ng2-bootstrap": "^1.1.16",
26
29
  "rxjs": "5.0.0-beta.12",
27
30
  "ts-helpers": "^1.1.1",
28
31
  "zone.js": "^0.6.23"
@@ -1,4 +1 @@
1
- <h1>
2
- {{title}}
3
- <router-outlet></router-outlet>
4
- </h1>
1
+ <router-outlet></router-outlet>
@@ -2,27 +2,28 @@ import { BrowserModule } from '@angular/platform-browser';
2
2
  import { NgModule } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { HttpModule } from '@angular/http';
5
- import { Angular2TokenService, A2tUiModule } from 'angular2-token';
6
5
 
7
6
  import { AppRoutesModule } from './app.routes.module';
8
-
9
7
  import { AppComponent } from './app.component';
10
- import { RegistrationComponent } from './registration/registration.component';
8
+ import { RegistrationModule } from './registration/'
9
+ import { LoginModule } from './login'
10
+ import { ConfirmAccountModule } from './confirm-account'
11
11
 
12
12
  @NgModule({
13
13
  imports: [
14
14
  BrowserModule,
15
15
  FormsModule,
16
16
  HttpModule,
17
+
17
18
  AppRoutesModule,
18
- A2tUiModule,
19
+ RegistrationModule,
20
+ ConfirmAccountModule,
21
+ LoginModule,
19
22
  ],
20
23
  declarations: [
21
- AppComponent,
22
- RegistrationComponent
24
+ AppComponent
23
25
  ],
24
26
  providers: [
25
- Angular2TokenService,
26
27
  ],
27
28
  bootstrap: [AppComponent]
28
29
  })
@@ -2,17 +2,27 @@ import { NgModule } from '@angular/core';
2
2
  import { RouterModule } from '@angular/router';
3
3
 
4
4
  import { RegistrationComponent } from './registration/registration.component'
5
+ import { LoginComponent } from './login/login.component'
6
+ import { ConfirmAccountComponent } from './confirm-account/confirm-account.component'
5
7
 
6
8
 
7
9
  const routes = [
8
10
  {
9
11
  path: '',
10
- redirectTo: 'registration',
12
+ redirectTo: 'login',
11
13
  pathMatch: 'full'
12
14
  },
13
15
  {
14
- path: 'registration',
16
+ path: 'signup',
15
17
  component: RegistrationComponent
18
+ },
19
+ {
20
+ path: 'login',
21
+ component: LoginComponent
22
+ },
23
+ {
24
+ path: 'account/confirm/:token',
25
+ component: ConfirmAccountComponent
16
26
  }
17
27
  ];
18
28
 
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,41 @@
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>
@@ -0,0 +1,24 @@
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 {}
@@ -0,0 +1,3 @@
1
+ .confirm-account {
2
+ padding-top: 120px;
3
+ }
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './confirm-account.component';
2
+ export * from './confirm-account.service';
3
+ export * from './confirm-account.module';
@@ -1,2 +1,4 @@
1
1
  export * from './app.component';
2
2
  export * from './app.module';
3
+ export * from './services';
4
+ export * from './registration';
@@ -0,0 +1,3 @@
1
+ export * from './login.service'
2
+ export * from './login.component'
3
+ export * from './login.module'
@@ -0,0 +1,40 @@
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
+ }
@@ -0,0 +1,43 @@
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>
@@ -0,0 +1,27 @@
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 {}
@@ -0,0 +1,48 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './registration.component'
2
+ export * from './registration.service'
3
+ export * from './registration.module'
@@ -1,14 +1,72 @@
1
-
2
- <form (ngSubmit)="doSubmit()">
3
- <div class="alert alert-success" *ngIf="success">Registration successful. Please confirm your email sent to {{user.email}} to proceed.</div>
4
- <div class="alert alert-danger" *ngIf="errors">
5
- <p *ngFor="let e of errors">{{e}}</p>
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
+ Create Account
12
+ </p>
13
+ <form #regForm="ngForm" (ngSubmit)="doSubmit($event); false">
14
+ <div *ngIf="success" class="alert alert-success">
15
+ <p>Success! A confirmation link has been sent to {{user.email}}.</p>
16
+ </div>
17
+ <div class="form-group" [ngClass]="(email.invalid && !email.pristine) || errors.email.length > 0 ? 'has-error' : ''">
18
+ <label for="email">Email</label>
19
+ <input type="email" class="form-control" id="email" placeholder="Email" required [(ngModel)]="user.email" name="email" #email="ngModel">
20
+ <span class="help-block" *ngFor="let e of errors.email">
21
+ Email {{e}}
22
+ </span>
23
+ <span [hidden]="email.valid || email.pristine" class=" help-block">
24
+ Email is required
25
+ </span>
26
+ </div>
27
+ <div class="form-group" [ngClass]="(name.invalid && !name.pristine) || errors.name.length > 0 ? 'has-error' : ''">
28
+ <label for="name">name</label>
29
+ <input type="text" class="form-control" id="name" placeholder="name" required [(ngModel)]="user.name" name="name" #name="ngModel">
30
+ <span [hidden]="name.valid || name.pristine" class=" help-block">
31
+ <span class="text-danger">Name is required</span>
32
+ </span>
33
+ <span class="help-block" *ngFor="let e of errors.name">
34
+ Password {{e}}
35
+ </span>
36
+ </div>
37
+ <div class="form-group" [ngClass]="(password.invalid && !password.pristine) || errors.password.length > 0 ? 'has-error' : ''">
38
+ <label for="password">Password</label>
39
+ <input type="password" class="form-control" id="password" placeholder="Password" required [(ngModel)]="user.password" name="password" #password="ngModel">
40
+ <span [hidden]="password.valid || password.pristine" class="help-block">
41
+ Password is required
42
+ </span>
43
+ <span class="help-block" *ngFor="let e of errors.password">
44
+ Password {{e}}
45
+ </span>
46
+ </div>
47
+ <div class="form-group" [ngClass]="(password_confirmation.invalid && !password_confirmation.pristine) || errors.password_confirmation.length > 0 ? 'has-error' : ''">
48
+ <label for="password">Confirm Password</label>
49
+ <input type="password" class="form-control" id="password_confirmation" placeholder="Confirm Password" required [(ngModel)]="user.password_confirmation" name="password_confirmation" #password_confirmation="ngModel">
50
+ <span [hidden]="password_confirmation.valid || password_confirmation.pristine" class="help-block">
51
+ Password confirmation is required
52
+ </span>
53
+ <span class="help-block" *ngFor="let e of errors.password_confirmation">
54
+ Password Confirmation {{e}}
55
+ </span>
56
+ </div>
57
+ <div class="form-group" style="margin-top: 20px;">
58
+ <button type="submit" class="btn btn-primary" [disabled]="!regForm.form.valid || submitting">
59
+ <span *ngIf="!submitting">Create Account</span>
60
+ <span *ngIf="submitting">Submitting...</span>
61
+ </button>
62
+ </div>
63
+ </form>
64
+ <hr>
65
+ <p>
66
+ Already have an account? <a [routerLink]="['/login']">Login</a>
67
+ </p>
68
+ </div>
6
69
  </div>
7
- <input type="text" name="name">
8
- <input type="email" name="email">
9
- <input type="password" name="password">
10
- <input type="password" name="password_confirmation">
11
- <button type="submit">Sign Up</button>
12
- </form>
70
+ </div>
71
+
13
72
 
14
- <div (click)="doSubmit()">CLICK ME</div>