hello-rails 0.0.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +97 -0
  4. data/Rakefile +23 -0
  5. data/app/controllers/hello/application_controller.rb +27 -0
  6. data/app/controllers/hello/authentication/sessions_controller.rb +81 -0
  7. data/app/controllers/hello/authentication/sign_in_controller.rb +39 -0
  8. data/app/controllers/hello/authentication/sudo_mode_controller.rb +40 -0
  9. data/app/controllers/hello/concerns/authentication/sign_in.rb +44 -0
  10. data/app/controllers/hello/concerns/management/forgot_password.rb +45 -0
  11. data/app/controllers/hello/concerns/management/reset_password.rb +33 -0
  12. data/app/controllers/hello/concerns/registration/sign_up.rb +64 -0
  13. data/app/controllers/hello/internationalization/locale_controller.rb +28 -0
  14. data/app/controllers/hello/management/accesses_controller.rb +29 -0
  15. data/app/controllers/hello/management/confirm_emails_controller.rb +41 -0
  16. data/app/controllers/hello/management/emails_controller.rb +67 -0
  17. data/app/controllers/hello/management/forgot_password_controller.rb +41 -0
  18. data/app/controllers/hello/management/passwords_controller.rb +57 -0
  19. data/app/controllers/hello/management/profiles_controller.rb +71 -0
  20. data/app/controllers/hello/management/reset_password_controller.rb +53 -0
  21. data/app/controllers/hello/registration/sign_up_controller.rb +63 -0
  22. data/app/helpers/hello/application_helper.rb +5 -0
  23. data/app/mailers/hello/mailer.rb +26 -0
  24. data/app/models/access.rb +2 -0
  25. data/app/models/credential.rb +2 -0
  26. data/app/models/email_credential.rb +2 -0
  27. data/app/models/password_credential.rb +2 -0
  28. data/app/models/user.rb +2 -0
  29. data/app/views/hello/authentication/_sign_in.html.erb +64 -0
  30. data/app/views/hello/authentication/new_session.html.erb +4 -0
  31. data/app/views/hello/authentication/sessions.html.erb +36 -0
  32. data/app/views/hello/authentication/sign_in.html.erb +3 -0
  33. data/app/views/hello/authentication/sudo_mode.html.erb +37 -0
  34. data/app/views/hello/internationalization/locales.html.erb +7 -0
  35. data/app/views/hello/mailer/confirm_email.html.erb +12 -0
  36. data/app/views/hello/mailer/forgot_password.html.erb +12 -0
  37. data/app/views/hello/mailer/welcome.html.erb +11 -0
  38. data/app/views/hello/management/accesses.html.erb +47 -0
  39. data/app/views/hello/management/cancel.html.erb +14 -0
  40. data/app/views/hello/management/email_credentials/expired_confirmation_token.html.erb +1 -0
  41. data/app/views/hello/management/email_credentials/index.html.erb +84 -0
  42. data/app/views/hello/management/password_credentials/_forgot_form.html.erb +17 -0
  43. data/app/views/hello/management/password_credentials/_reset_form.html.erb +39 -0
  44. data/app/views/hello/management/password_credentials/forgot.html.erb +10 -0
  45. data/app/views/hello/management/password_credentials/forgot_success.html.erb +26 -0
  46. data/app/views/hello/management/password_credentials/reset.html.erb +3 -0
  47. data/app/views/hello/management/password_credentials/show.html.erb +25 -0
  48. data/app/views/hello/management/user.html.erb +73 -0
  49. data/app/views/hello/registration/_sign_up.html.erb +86 -0
  50. data/app/views/hello/registration/sign_up.html.erb +3 -0
  51. data/app/views/hello/registration/sign_up_widget.html.erb +3 -0
  52. data/app/views/hello/shared/_errors.html.erb +11 -0
  53. data/app/views/hello/shared/_flash.html.erb +8 -0
  54. data/app/views/hello/shared/_nav_pills.html.erb +15 -0
  55. data/app/views/hello/shared/_session_expiration.html.erb +15 -0
  56. data/app/views/hello/shared/_settings.html.erb +41 -0
  57. data/config/locales/hello.en.yml +69 -0
  58. data/config/locales/hello.es.yml +71 -0
  59. data/config/locales/hello.fr.yml +71 -0
  60. data/config/locales/hello.pl.yml +71 -0
  61. data/config/locales/hello.pt-BR.yml +71 -0
  62. data/config/locales/hello.zh-CN.yml +71 -0
  63. data/config/locales/hello.zh-TW.yml +71 -0
  64. data/config/routes.rb +74 -0
  65. data/db/migrate/1_create_credentials.rb +17 -0
  66. data/db/migrate/2_create_accesses.rb +15 -0
  67. data/db/migrate/3_create_users.rb +23 -0
  68. data/lib/generators/hello/concerns/USAGE +8 -0
  69. data/lib/generators/hello/concerns/concerns_generator.rb +10 -0
  70. data/lib/generators/hello/from_devise/USAGE +8 -0
  71. data/lib/generators/hello/from_devise/from_devise_generator.rb +13 -0
  72. data/lib/generators/hello/from_devise/templates/from_devise.migration.rb +39 -0
  73. data/lib/generators/hello/install/USAGE +8 -0
  74. data/lib/generators/hello/install/install_generator.rb +94 -0
  75. data/lib/generators/hello/install/templates/application.html.erb +35 -0
  76. data/lib/generators/hello/install/templates/hello_helper.rb +16 -0
  77. data/lib/generators/hello/install/templates/initializer.rb +24 -0
  78. data/lib/generators/hello/install/templates/models/concerns/user/authorization.rb +21 -0
  79. data/lib/generators/hello/install/templates/models/user.rb +9 -0
  80. data/lib/generators/hello/install/templates/onboarding/index.html.erb +5 -0
  81. data/lib/generators/hello/install/templates/onboarding/onboarding_controller.rb +33 -0
  82. data/lib/generators/hello/install/templates/root/index.html.erb +7 -0
  83. data/lib/generators/hello/install/templates/root/root_controller.rb +6 -0
  84. data/lib/generators/hello/install/templates/users/controllers/users_controller.rb +71 -0
  85. data/lib/generators/hello/install/templates/users/views/users/index.html.erb +29 -0
  86. data/lib/generators/hello/install/templates/users/views/users/list.html.erb +35 -0
  87. data/lib/generators/hello/install/templates/users/views/users/new.html.erb +60 -0
  88. data/lib/generators/hello/install/templates/users/views/users/show.html.erb +74 -0
  89. data/lib/generators/hello/locales/USAGE +12 -0
  90. data/lib/generators/hello/locales/locales_generator.rb +64 -0
  91. data/lib/generators/hello/views/USAGE +8 -0
  92. data/lib/generators/hello/views/views_generator.rb +9 -0
  93. data/lib/hello-rails.rb +1 -0
  94. data/lib/hello.rb +36 -0
  95. data/lib/hello/CHANGES.md +26 -0
  96. data/lib/hello/business.rb +47 -0
  97. data/lib/hello/business/authentication/sign_in.rb +92 -0
  98. data/lib/hello/business/authentication/sign_out.rb +8 -0
  99. data/lib/hello/business/authentication/sudo_mode_authentication.rb +25 -0
  100. data/lib/hello/business/authentication/sudo_mode_expiration.rb +17 -0
  101. data/lib/hello/business/base.rb +33 -0
  102. data/lib/hello/business/internationalization/update_locale.rb +33 -0
  103. data/lib/hello/business/management/add_email.rb +19 -0
  104. data/lib/hello/business/management/cancel_account.rb +22 -0
  105. data/lib/hello/business/management/confirm_email.rb +36 -0
  106. data/lib/hello/business/management/forgot_password.rb +47 -0
  107. data/lib/hello/business/management/remove_email.rb +19 -0
  108. data/lib/hello/business/management/reset_password.rb +34 -0
  109. data/lib/hello/business/management/send_confirmation_email.rb +40 -0
  110. data/lib/hello/business/management/unlink_access.rb +8 -0
  111. data/lib/hello/business/management/update_profile.rb +44 -0
  112. data/lib/hello/business/registration/sign_up.rb +159 -0
  113. data/lib/hello/configuration.rb +12 -0
  114. data/lib/hello/encryptors.rb +6 -0
  115. data/lib/hello/encryptors/complex.rb +25 -0
  116. data/lib/hello/encryptors/simple.rb +27 -0
  117. data/lib/hello/engine.rb +23 -0
  118. data/lib/hello/errors.rb +12 -0
  119. data/lib/hello/locales.rb +238 -0
  120. data/lib/hello/middleware.rb +13 -0
  121. data/lib/hello/rails_active_record.rb +10 -0
  122. data/lib/hello/rails_active_record/access.rb +65 -0
  123. data/lib/hello/rails_active_record/credential.rb +51 -0
  124. data/lib/hello/rails_active_record/email_credential.rb +60 -0
  125. data/lib/hello/rails_active_record/password_credential.rb +70 -0
  126. data/lib/hello/rails_active_record/user.rb +99 -0
  127. data/lib/hello/rails_controller.rb +124 -0
  128. data/lib/hello/rails_controller/restrict_by_role.rb +79 -0
  129. data/lib/hello/rails_helper.rb +35 -0
  130. data/lib/hello/request_manager.rb +14 -0
  131. data/lib/hello/request_manager/abstract.rb +77 -0
  132. data/lib/hello/request_manager/factory.rb +32 -0
  133. data/lib/hello/request_manager/stateful.rb +53 -0
  134. data/lib/hello/request_manager/stateful/finder.rb +58 -0
  135. data/lib/hello/request_manager/stateful/session_wrapper.rb +37 -0
  136. data/lib/hello/request_manager/stateless.rb +35 -0
  137. data/lib/hello/time_zones.rb +7 -0
  138. data/lib/hello/utils.rb +11 -0
  139. data/lib/hello/utils/device_name.rb +34 -0
  140. data/lib/hello/version.rb +4 -0
  141. data/lib/tasks/hello_tasks.rake +4 -0
  142. data/spec/bdd/hello/authentication/authorization/authorization_role_restriction_spec.rb +291 -0
  143. data/spec/bdd/hello/authentication/authorization/authorization_router_constraints_spec.rb +41 -0
  144. data/spec/bdd/hello/authentication/authorization/authorization_sensitive_restriction_spec.rb +84 -0
  145. data/spec/bdd/hello/authentication/authorization/bdd.yml +1 -0
  146. data/spec/bdd/hello/authentication/bdd.yml +1 -0
  147. data/spec/bdd/hello/authentication/classic_sign_in_spec.rb +264 -0
  148. data/spec/bdd/hello/authentication/manage_sessions_spec.rb +292 -0
  149. data/spec/bdd/hello/authentication/sign_out_spec.rb +159 -0
  150. data/spec/bdd/hello/bdd.yml +1 -0
  151. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/bdd.yml +1 -0
  152. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_locale_page_spec.rb +90 -0
  153. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_profile_page_spec.rb +64 -0
  154. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_sign_in_form_spec.rb +31 -0
  155. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_sign_up_form_spec.rb +34 -0
  156. data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/bdd.yml +1 -0
  157. data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_profile_page_spec.rb +14 -0
  158. data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_sign_in_form_spec.rb +14 -0
  159. data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_sign_up_form_spec.rb +14 -0
  160. data/spec/bdd/hello/internalionalization/bdd.yml +1 -0
  161. data/spec/bdd/hello/management/bdd.yml +1 -0
  162. data/spec/bdd/hello/management/cancel_account_spec.rb +128 -0
  163. data/spec/bdd/hello/management/manage_email_credentials/bdd.yml +1 -0
  164. data/spec/bdd/hello/management/manage_email_credentials/manage_email_credentials_emails_api_spec.rb +7 -0
  165. data/spec/bdd/hello/management/manage_email_credentials/manage_email_credentials_emails_page_spec.rb +252 -0
  166. data/spec/bdd/hello/management/manage_password_credentials/bdd.yml +1 -0
  167. data/spec/bdd/hello/management/manage_password_credentials/manage_password_forgot_password_spec.rb +68 -0
  168. data/spec/bdd/hello/management/manage_password_credentials/manage_password_page_spec.rb +60 -0
  169. data/spec/bdd/hello/management/manage_password_credentials/manage_password_reset_password_spec.rb +145 -0
  170. data/spec/bdd/hello/management/manage_profile/bdd.yml +1 -0
  171. data/spec/bdd/hello/management/manage_profile/manage_profile_api_spec.rb +7 -0
  172. data/spec/bdd/hello/management/manage_profile/manage_profile_page_spec.rb +65 -0
  173. data/spec/bdd/hello/management/manage_social_credentials/bdd.yml +1 -0
  174. data/spec/bdd/hello/management/manage_social_credentials/manage_social_credentials_pending_spec.rb +7 -0
  175. data/spec/bdd/hello/management/unlink_sessions_spec.rb +59 -0
  176. data/spec/bdd/hello/other/bdd.yml +1 -0
  177. data/spec/bdd/hello/other/create_user_spec.rb +70 -0
  178. data/spec/bdd/hello/other/impersonate_user_spec.rb +58 -0
  179. data/spec/bdd/hello/other/list_users_spec.rb +86 -0
  180. data/spec/bdd/hello/registration/bdd.yml +1 -0
  181. data/spec/bdd/hello/registration/classic_sign_up_spec.rb +228 -0
  182. data/spec/bdd/hello/registration/onboarding_process_spec.rb +101 -0
  183. data/spec/bdd/hello/support.rb +62 -0
  184. data/spec/business/hello/authentication/sign_in_spec.rb +72 -0
  185. data/spec/business/hello/registration/sign_up_spec.rb +258 -0
  186. data/spec/controllers/authentication_spec.rb +97 -0
  187. data/spec/controllers/localization_spec.rb +65 -0
  188. data/spec/controllers/request_can_carry_an_access_token_spec.rb +223 -0
  189. data/spec/fixtures/hello/password_mailer/confirmation +3 -0
  190. data/spec/fixtures/hello/password_mailer/forgot +3 -0
  191. data/spec/fixtures/hello/password_mailer/sign_up +3 -0
  192. data/spec/mailers/hello/mailer_spec.rb +53 -0
  193. data/spec/models/access_spec.rb +19 -0
  194. data/spec/models/credential_spec.rb +9 -0
  195. data/spec/models/email_credential_spec.rb +163 -0
  196. data/spec/models/hello/sign_up_model_spec.rb +64 -0
  197. data/spec/models/password_credential_spec.rb +75 -0
  198. data/spec/models/user_spec.rb +93 -0
  199. data/spec/others/configuration_spec.rb +25 -0
  200. data/spec/others/encryptors/complex_spec.rb +26 -0
  201. data/spec/others/encryptors/simple_spec.rb +21 -0
  202. data/spec/others/helper_spec.rb +10 -0
  203. data/spec/others/localization_consistency_spec.rb +73 -0
  204. data/spec/requests/forgot_password_spec.rb +36 -0
  205. data/spec/requests/reset_password_spec.rb +7 -0
  206. data/spec/requests/security/user_spec.rb +19 -0
  207. data/spec/routing/hello/accesses_routing_spec.rb +17 -0
  208. data/spec/routing/hello/emails_routing_spec.rb +37 -0
  209. data/spec/routing/hello/locale_routing_spec.rb +17 -0
  210. data/spec/routing/hello/profile_routing_spec.rb +29 -0
  211. data/spec/routing/hello/registration_routing_spec.rb +23 -0
  212. data/spec/routing/hello/sign_out_routing_spec.rb +11 -0
  213. data/spec/routing/hello/sudo_mode_routing_spec.rb +23 -0
  214. data/spec/routing/hello/users_routing_spec.rb +15 -0
  215. data/spec/spec_helper.rb +9 -0
  216. data/spec/spec_helper/codeclimate.rb +2 -0
  217. data/spec/spec_helper/configure_rspec.rb +23 -0
  218. data/spec/spec_helper/create_database.rb +5 -0
  219. data/spec/spec_helper/dummy_and_test_dependencies.rb +17 -0
  220. data/spec/spec_helper/support.rb +1 -0
  221. data/spec/support/factories.rb +60 -0
  222. data/spec/support/feature_injection.rb +118 -0
  223. data/spec/support/features/feature_support_given.rb +46 -0
  224. data/spec/support/features/feature_support_then.rb +43 -0
  225. data/spec/support/helpers/aliases.rb +76 -0
  226. data/spec/support/helpers/configuration.rb +6 -0
  227. data/spec/support/helpers/current.rb +16 -0
  228. data/spec/support/helpers/expect.rb +61 -0
  229. data/spec/support/helpers/given.rb +49 -0
  230. data/spec/support/helpers/shortcuts.rb +24 -0
  231. data/spec/support/helpers/then.rb +29 -0
  232. data/spec/support/helpers/when.rb +108 -0
  233. data/spec/support/requests/request_support.rb +8 -0
  234. data/spec/utils/device_name_spec.rb +228 -0
  235. metadata +562 -11
@@ -0,0 +1,17 @@
1
+ <%= form_for @forgot_password, as: :forgot_password, url: forgot_passwords_path, html: {class: "form-horizontal", role: "form"} do |f| %>
2
+
3
+ <!-- Errors -->
4
+ <% if @forgot_password.errors.any? %>
5
+ <%= render '/hello/shared/errors', business: @forgot_password %>
6
+ <% end %>
7
+
8
+ <div class="form-group">
9
+ <div class="col-sm-4">
10
+ <%= f.text_field :login, class: "form-control ", placeholder: "Email or Username" %>
11
+ </div>
12
+ <div class="col-sm-2">
13
+ <%= f.submit "Continue", class: "btn btn-primary" %>
14
+ </div>
15
+ </div>
16
+
17
+ <% end %>
@@ -0,0 +1,39 @@
1
+ <%= form_for @reset_password, as: :reset_password, url: @current_url, html: {class: "form-horizontal", role: "form"} do |f| %>
2
+
3
+ <!-- Errors -->
4
+ <% if @reset_password.errors.any? %>
5
+ <%= render '/hello/shared/errors', business: @reset_password %>
6
+ <% end %>
7
+
8
+ <% @user.email_credentials.map(&:email).each do |email| %>
9
+ <div class="form-group">
10
+ <%= f.label :email, class: "col-sm-4 control-label" %>
11
+ <div class="col-sm-4">
12
+ <span class="form-control" style="border: 0px; box-shadow: none">
13
+ <%= email %>
14
+ </span>
15
+ </div>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :username, class: "col-sm-4 control-label" %>
21
+ <div class="col-sm-4">
22
+ <span class="form-control" style="border: 0px; box-shadow: none">
23
+ <%= @user.username %>
24
+ </span>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="form-group">
29
+ <%= f.label :password, class: "col-sm-4 control-label" %>
30
+ <div class="col-sm-4">
31
+ <%= f.password_field :password, class: "form-control", placeholder: "Password" %>
32
+ </div>
33
+ </div>
34
+ <div class="form-group">
35
+ <div class="col-sm-offset-4 col-sm-4">
36
+ <%= f.submit "Save", class: "btn btn-primary" %>
37
+ </div>
38
+ </div>
39
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h2 class="page-header">I forgot my password</h2>
2
+
3
+ <blockquote style="border-color: #5bc0de">
4
+ <p>To reset your password, enter the email address you use to sign in to this website.</p>
5
+ <p>This can be any email address associated with your account.</p>
6
+ <p>We will send you a verification email.</p>
7
+ <footer>You can also enter your <strong>@username</strong>.</footer>
8
+ </blockquote>
9
+
10
+ <%= render 'hello/management/password_credentials/forgot_form' %>
@@ -0,0 +1,26 @@
1
+ <% if @forgot_password.login %>
2
+ <h1>Email sent to "<%= @forgot_password.login %>"</h1>
3
+ <% end %>
4
+
5
+ <div class="alert alert-success" role="alert">
6
+ <%= @forgot_password.success_message.html_safe %>
7
+ </div>
8
+
9
+
10
+ <blockquote style="border-color: #a94442">
11
+ <p class="text-danger"><strong>Q: Didn't receive the password reset email?</strong></p>
12
+ <p>
13
+ A: Check your spam folder for an email from
14
+ <strong><%= @sender %></strong>
15
+ </p>
16
+ </blockquote>
17
+
18
+ <blockquote style="border-color: #a94442">
19
+ <p class="text-danger"><strong>Q: You still don't see the email?</strong></p>
20
+ <p>A: Try a different way to get into your account.</p>
21
+ <footer>
22
+ <strong>Suggestion:</strong>
23
+ <%= link_to "Click Here", hello.forgot_passwords_path %>
24
+ and try again with a different email.
25
+ </footer>
26
+ </blockquote>
@@ -0,0 +1,3 @@
1
+ <h2 class="page-header">Reset Password</h2>
2
+
3
+ <%= render 'hello/management/password_credentials/reset_form' %>
@@ -0,0 +1,25 @@
1
+ <div class="row">
2
+
3
+ <%= render '/hello/shared/settings' %>
4
+
5
+ <div class="col-sm-3-offset col-md-2-offset col-sm-9 col-md-10">
6
+
7
+ <%= form_for @password_credential, url: password_path, html: {class: "form-horizontal", role: "form"} do |f| %>
8
+ <%= render '/hello/shared/errors', business: @update_profile %>
9
+
10
+ <div class="form-group">
11
+ <%= f.label :password, class: "col-sm-4 control-label" %>
12
+ <div class="col-sm-4">
13
+ <%= f.password_field :password, class: "form-control", placeholder: "Password" %>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="form-group">
18
+ <div class="col-sm-offset-4 col-sm-4">
19
+ <%= f.submit "Update Profile", class: "btn btn-default" %>
20
+ </div>
21
+ </div>
22
+ <% end %>
23
+
24
+ </div>
25
+ </div>
@@ -0,0 +1,73 @@
1
+ <div class="row">
2
+
3
+ <%= render '/hello/shared/settings' %>
4
+
5
+ <div class="col-sm-3-offset col-md-2-offset col-sm-9 col-md-10">
6
+
7
+ <%= form_for @user, url: profile_path, html: {class: "form-horizontal", role: "form"} do |f| %>
8
+ <%= render '/hello/shared/errors', business: @user_business %>
9
+
10
+ <% current_user.email_credentials.each do |credential| %>
11
+ <div class="form-group">
12
+ <%= f.label :email, class: "col-sm-4 control-label" %>
13
+ <div class="col-sm-4">
14
+ <span class="form-control" style="border: 0px; box-shadow: none">
15
+ <%= credential.email %>
16
+ <%= link_to "edit", hello.emails_path %>
17
+ </span>
18
+ </div>
19
+ </div>
20
+
21
+ <% end %>
22
+
23
+
24
+
25
+
26
+ <div class="form-group">
27
+ <%= f.label :name, class: "col-sm-4 control-label" %>
28
+ <div class="col-sm-4">
29
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="form-group">
34
+ <%= f.label :language, class: "col-sm-4 control-label" %>
35
+ <div class="col-sm-4">
36
+ <%= f.select :locale, hello_locale_select_options, {}, class: "form-control" %>
37
+ </div>
38
+ </div>
39
+
40
+ <div class="form-group">
41
+ <%= f.label :time_zone, class: "col-sm-4 control-label" %>
42
+ <div class="col-sm-4">
43
+ <%= f.time_zone_select :time_zone, nil, {}, class: "form-control" %>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="form-group">
48
+ <%= f.label :current_time, class: "col-sm-4 control-label" %>
49
+ <div class="col-sm-4">
50
+ <span class="form-control current_time" style="border: 0px; box-shadow: none">
51
+ <%= Time.now.in_time_zone %>
52
+ </span>
53
+ </div>
54
+ </div>
55
+
56
+ <div class="form-group">
57
+ <%= f.label :username, class: "col-sm-4 control-label" %>
58
+ <div class="col-sm-4">
59
+ <%= f.text_field :username, class: "form-control", placeholder: "Username" %>
60
+ </div>
61
+ </div>
62
+
63
+
64
+
65
+ <div class="form-group">
66
+ <div class="col-sm-offset-4 col-sm-4">
67
+ <%= f.submit "Update Profile", class: "btn btn-default" %>
68
+ </div>
69
+ </div>
70
+ <% end %>
71
+
72
+ </div>
73
+ </div>
@@ -0,0 +1,86 @@
1
+ <% if x = sign_up_disabled %>
2
+ <h2>Email Registration is temporarily disabled.</h2>
3
+ <p>Reason: <%= x[:reason] %></p>
4
+ <p>Until: <%= x[:until] %></p>
5
+ <% else %>
6
+ <%= form_for @sign_up, as: :sign_up, url: sign_up_path, html: {class: "form-horizontal", role: "form"} do |f| %>
7
+
8
+ <!-- Errors -->
9
+ <% if @sign_up.errors.any? %>
10
+ <%= render '/hello/shared/errors', business: @sign_up %>
11
+ <% end %>
12
+
13
+ <div class="form-group">
14
+ <%= f.label :name, class: "col-sm-4 control-label" %>
15
+ <div class="col-sm-4">
16
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
17
+ </div>
18
+ </div>
19
+ <div class="form-group">
20
+ <%= f.label :email, class: "col-sm-4 control-label" %>
21
+ <div class="col-sm-4">
22
+ <p>
23
+ <%= f.text_field :email, class: "form-control", placeholder: "Email" %>
24
+ </p>
25
+
26
+ <% if @sign_up.email_taken? %>
27
+ <blockquote style="border-color: #a94442">
28
+ <p class="text-danger">This email address has already been registered.</p>
29
+ <p><%= link_to "Log in", hello.sign_in_path %> instead.</p>
30
+ <footer>
31
+ <%= link_to "I forgot my password", hello.forgot_passwords_path %>.
32
+ </footer>
33
+ </blockquote>
34
+ <% end %>
35
+ </div>
36
+ </div>
37
+ <div class="form-group">
38
+ <%= f.label :username, class: "col-sm-4 control-label" %>
39
+ <div class="col-sm-4">
40
+ <p>
41
+ <%= f.text_field :username, class: "form-control", placeholder: "Username" %>
42
+ </p>
43
+
44
+ <% if @sign_up.username_taken? %>
45
+ <blockquote style="border-color: #a94442">
46
+ <p class="text-danger">This username has already been registered.</p>
47
+ <p><%= link_to "Log in", hello.sign_in_path %> instead.</p>
48
+ <footer>
49
+ <%= link_to "I forgot my password", hello.forgot_passwords_path %>.
50
+ </footer>
51
+ </blockquote>
52
+ <% end %>
53
+ </div>
54
+ </div>
55
+ <div class="form-group">
56
+ <%= f.label :password, class: "col-sm-4 control-label" %>
57
+ <div class="col-sm-4">
58
+ <%= f.password_field :password, class: "form-control", placeholder: "Password" %>
59
+ </div>
60
+ </div>
61
+
62
+ <% if false %>
63
+ <!--
64
+ <div class="form-group">
65
+ <%= f.label :locale, class: "col-sm-4 control-label" %>
66
+ <div class="col-sm-4">
67
+ <%= f.select :locale, hello_locale_select_options, {}, class: "form-control" %>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="form-group">
72
+ <%= f.label :time_zone, class: "col-sm-4 control-label" %>
73
+ <div class="col-sm-4">
74
+ <%= f.time_zone_select :time_zone, nil, {}, class: "form-control" %>
75
+ </div>
76
+ </div>
77
+ -->
78
+ <% end %>
79
+
80
+ <div class="form-group">
81
+ <div class="col-sm-offset-4 col-sm-4">
82
+ <%= f.submit "Sign Up", class: "btn btn-primary" %>
83
+ </div>
84
+ </div>
85
+ <% end %>
86
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h2 class="page-header">Sign Up</h2>
2
+
3
+ <%= render 'hello/registration/sign_up' %>
@@ -0,0 +1,3 @@
1
+ <h2 class="page-header">Sign Up</h2>
2
+
3
+ <%= render 'hello/registration/sign_up' %>
@@ -0,0 +1,11 @@
1
+ <% if business.errors.any? %>
2
+ <div id="error_explanation">
3
+ <h2 class="errors"><%= business.error_message %></h2>
4
+
5
+ <ul>
6
+ <% business.errors.full_messages.each do |msg| %>
7
+ <li><%= msg %></li>
8
+ <% end %>
9
+ </ul>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,8 @@
1
+
2
+ <% if notice %>
3
+ <div class="alert alert-success"><%= notice %></div>
4
+ <% end %>
5
+
6
+ <% if alert %>
7
+ <div class="alert alert-warning"><%= alert %></div>
8
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <ul class="nav nav-pills pull-right">
2
+ <li><%= link_to human_current_locale, hello.locale_path %></li>
3
+ <li><%= link_to "User List", users_path %></li>
4
+
5
+ <% if signed_in? %>
6
+ <li><%= link_to "My Profile", current_user %></li>
7
+ <li><%= link_to "Settings", hello_path %></li>
8
+ <li><%= link_to "Switch Accounts", hello.sessions_path %></li>
9
+ <li><%= link_to "Sign Out", hello.sign_out_path, method: :delete %></li>
10
+ <% else %>
11
+ <li><%= link_to "Sign Up", hello.sign_up_path %></li>
12
+ <li><%= link_to "Sign In", hello.sign_in_path %></li>
13
+ <li><%= link_to "Forgot Password", hello.forgot_passwords_path %></li>
14
+ <% end %>
15
+ </ul>
@@ -0,0 +1,15 @@
1
+ <% if signed_in? %>
2
+ <p>
3
+ <small>
4
+ Your session expires in <%= time_ago_in_words current_access.expires_at %>
5
+ </small>
6
+
7
+ <% if sudo_mode? %>
8
+ <small>
9
+ |
10
+ Sudo Mode expires in <%= time_ago_in_words current_access.sudo_expires_at %>
11
+ (<%= link_to "expire it now", hello.sudo_mode_expire_path %>)
12
+ </small>
13
+ <% end %>
14
+ </p>
15
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <% if not signed_in? %>
2
+
3
+ <h2 class="page-header">Settings (not signed in)</h2>
4
+ <div class="col-sm-3 col-md-2">
5
+ </div>
6
+
7
+ <% else %>
8
+
9
+ <h2 class="page-header">Settings</h2>
10
+
11
+ <div class="col-sm-3 col-md-2">
12
+ <div class="list-group">
13
+ <%= nav_link_to "Profile",
14
+ hello.profile_path,
15
+ {class: "list-group-item"},
16
+ {selected_class: "active"}
17
+ %>
18
+ <%= nav_link_to "Password",
19
+ hello.passwords_path,
20
+ {class: "list-group-item"},
21
+ {selected_class: "active"}
22
+ %>
23
+ <%= nav_link_to "Emails (#{current_user.email_credentials.count})",
24
+ hello.emails_path,
25
+ {class: "list-group-item"},
26
+ {selected_class: "active"}
27
+ %>
28
+ <%= nav_link_to "Devices (#{current_user.accesses_count})",
29
+ hello.accesses_path,
30
+ {class: "list-group-item"},
31
+ {selected_class: "active"}
32
+ %>
33
+ <%= nav_link_to "Cancel Account",
34
+ hello.cancel_profile_path,
35
+ {class: "list-group-item"},
36
+ {selected_class: "active"}
37
+ %>
38
+ </div>
39
+ </div>
40
+
41
+ <% end %>
@@ -0,0 +1,69 @@
1
+ # https://github.com/hello-gem/hello
2
+
3
+ en:
4
+ hello:
5
+ locale_name: "English"
6
+
7
+ mailer:
8
+ welcome:
9
+ subject: "Welcome to our website"
10
+ confirm_email:
11
+ subject: "Confirm This Email"
12
+ forgot_password:
13
+ subject: "Reset Password Instructions"
14
+
15
+ business:
16
+ registration:
17
+ sign_up:
18
+ success: "You have signed up successfully"
19
+ error:
20
+ one: "1 error was found while trying to sign up"
21
+ other: "%{count} errors were found while trying to sign up"
22
+ internationalization:
23
+ update_locale:
24
+ success: "Your current language has been applied successfully. '%{locale_name}'"
25
+ authentication:
26
+ sign_in:
27
+ success: "You have signed in successfully"
28
+ error:
29
+ one: "1 error was found while trying to sign in"
30
+ other: "%{count} errors were found while trying to sign in"
31
+ sign_out:
32
+ success: "You have signed out!"
33
+ sudo_mode_authentication:
34
+ success: "Now we know it's really you. We won't be asking your password again for 60 minutes"
35
+ alert: "Incorrect Password"
36
+ sudo_mode_expiration:
37
+ success: "We will now ask your password for sensitive access"
38
+ management:
39
+ add_email:
40
+ success: "%{email} was successfully added"
41
+ remove_email:
42
+ success: "%{email} was successfully removed"
43
+ unlink_access:
44
+ success: "Device has been unlinked from your account"
45
+ alert: "There was an error while unlinking this device"
46
+ forgot_password:
47
+ success: "To get back into your account, follow the instructions we've sent to your <strong>\"%{login}\"</strong> email address."
48
+ error:
49
+ one: "1 error was found while locating your credentials"
50
+ other: "%{count} errors were found while locating your credentials"
51
+ reset_password:
52
+ success: "You have reset your password successfully"
53
+ alert: "This link has expired, please ask for a new link"
54
+ error:
55
+ one: "1 error was found while resetting your password"
56
+ other: "%{count} errors were found while resetting your password"
57
+ send_confirmation_email:
58
+ success: "We have sent a confirmation email to %{email}"
59
+ confirm_email:
60
+ success: "%{email} has been confirmed successfully."
61
+ alert: "This link has expired, please ask for a new link"
62
+ cancel_account:
63
+ success: "You have deactivated your account successfully"
64
+ alert: "Terminating your account would cause other users to experience errors while using our website. Please contact any of our staff members and ask to have your account removed manually."
65
+ update_profile:
66
+ success: "You have updated your profile successfully"
67
+ error:
68
+ one: "1 error was found while updating your profile"
69
+ other: "%{count} errors were found while updating your profile"