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,63 @@
1
+ module Hello
2
+ module Registration
3
+ # you really should be overriding concerns instead of this file
4
+ class SignUpController < ApplicationController
5
+ include Hello::Concerns::Registration::SignUp
6
+
7
+ dont_kick_people
8
+
9
+ before_action do
10
+ @sign_up = Hello::Business::Registration::SignUp.new
11
+ end
12
+
13
+ # GET /hello/sign_up
14
+ def index
15
+ render_sign_up
16
+ end
17
+
18
+ # GET /hello/sign_up/widget
19
+ def widget
20
+ render 'hello/registration/sign_up_widget', layout: false
21
+ end
22
+
23
+ # POST /hello/sign_up
24
+ def create
25
+ if sign_up_disabled
26
+ _create_disabled
27
+ else
28
+ _create_enabled
29
+ end
30
+ end
31
+
32
+ # GET /hello/sign_up/disabled
33
+ def disabled
34
+ render_sign_up
35
+ end
36
+
37
+ protected
38
+
39
+ def render_sign_up
40
+ render 'hello/registration/sign_up'
41
+ end
42
+
43
+ def _create_enabled
44
+ if @sign_up.register(params.require(:sign_up))
45
+ flash[:notice] = @sign_up.success_message
46
+ on_success
47
+ else
48
+ on_failure
49
+ end
50
+ end
51
+
52
+ def _create_disabled
53
+ @sign_up.errors[:base] << "Email Registration is temporarily disabled"
54
+ if sign_up_disabled.is_a?(Hash)
55
+ sign_up_disabled.each do |k, v|
56
+ @sign_up.errors[k] << Array(v).flatten
57
+ end
58
+ end
59
+ on_failure
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,5 @@
1
+ # this gem requires this file to be here
2
+ module Hello
3
+ module ApplicationHelper
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ module Hello
2
+ class Mailer < ActionMailer::Base
3
+ default from: Hello.configuration.mailer_sender
4
+
5
+ def welcome(email, user, password)
6
+ @user = user
7
+ @password = password
8
+
9
+ mail to: email
10
+ end
11
+
12
+ def confirm_email(email, user, url)
13
+ @user = user
14
+ @url = url
15
+
16
+ mail to: email
17
+ end
18
+
19
+ def forgot_password(email, user, url)
20
+ @user = user
21
+ @url = url
22
+
23
+ mail to: email
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,2 @@
1
+ class Access < Hello::RailsActiveRecord::Access
2
+ end
@@ -0,0 +1,2 @@
1
+ class Credential < Hello::RailsActiveRecord::Credential
2
+ end
@@ -0,0 +1,2 @@
1
+ class EmailCredential < Hello::RailsActiveRecord::EmailCredential
2
+ end
@@ -0,0 +1,2 @@
1
+ class PasswordCredential < Hello::RailsActiveRecord::PasswordCredential
2
+ end
@@ -0,0 +1,2 @@
1
+ class User < Hello::RailsActiveRecord::User
2
+ end
@@ -0,0 +1,64 @@
1
+ <%= form_for @sign_in, as: :sign_in, url: sign_in_path, html: {class: "form-horizontal", role: "form"} do |f| %>
2
+
3
+ <!-- Errors -->
4
+ <% if @sign_in.errors.any? %>
5
+ <%= render '/hello/shared/errors', business: @sign_in %>
6
+ <% end %>
7
+
8
+ <div class="form-group">
9
+ <%= f.label :login, "Email or Username", class: "col-sm-4 control-label" %>
10
+ <div class="col-sm-4">
11
+ <%= f.text_field :login, class: "form-control", placeholder: "Email or Username" %>
12
+
13
+ <% if @sign_in.bad_login? %>
14
+ <blockquote style="border-color: #a94442">
15
+ <p class="text-danger">This login was not found in our database.</p>
16
+ <p>Do you want to <%= link_to "Sign Up", hello.sign_up_path %> instead?</p>
17
+ </blockquote>
18
+ <% end %>
19
+
20
+ </div>
21
+
22
+ </div>
23
+
24
+
25
+ <div class="form-group">
26
+ <%= f.label :password, class: "col-sm-4 control-label" %>
27
+ <div class="col-sm-4">
28
+ <%= f.password_field :password, class: "form-control", placeholder: "Password" %>
29
+
30
+ <% if @sign_in.bad_password? %>
31
+ <blockquote style="border-color: #a94442">
32
+ <p class="text-danger">Your password does not match that in our database.</p>
33
+ <footer>
34
+ Did you <%= link_to "forget your password", hello.forgot_passwords_path %>?
35
+ </footer>
36
+ </blockquote>
37
+ <% end %>
38
+
39
+ </div>
40
+ </div>
41
+
42
+ <div class="form-group">
43
+ <div class="col-sm-offset-4 col-sm-4">
44
+ <div class="checkbox">
45
+ <label>
46
+ <%= check_box_tag :keep_me, '1', false %>
47
+ Keep me signed in for <strong>30</strong> days
48
+ </label>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <!--
53
+ <div class="form-group">
54
+ <div class="col-sm-offset-4 col-sm-4">
55
+ <%= link_to "I forgot my password", hello.forgot_passwords_path %>
56
+ </div>
57
+ </div>
58
+ -->
59
+ <div class="form-group">
60
+ <div class="col-sm-offset-4 col-sm-4">
61
+ <%= f.submit "Sign In", class: "btn btn-primary" %>
62
+ </div>
63
+ </div>
64
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <h1>Add Account</h1>
2
+
3
+ <p><%= link_to "Sign Up", hello.sign_up_path, class: 'btn btn-xs btn-info', style: 'width: 150px' %></li>
4
+ <p><%= link_to "Sign In", hello.sign_in_path, class: 'btn btn-xs btn-info', style: 'width: 150px' %></p>
@@ -0,0 +1,36 @@
1
+ <h1>Switch Accounts</h1>
2
+
3
+ <table class="table table-condensed">
4
+ <thead>
5
+ <tr>
6
+ <th>Username</th>
7
+ <th>Name</th>
8
+ <th>Role</th>
9
+ <th>Expiry</th>
10
+ <th colspan="2">Actions</th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <% @accesses.each do |a| %>
16
+ <tr>
17
+ <td><%= link_to a.user.username, a.user %></td>
18
+ <td><%= a.user.name %></td>
19
+ <td><%= a.user.role %></td>
20
+ <td><%= distance_of_time_in_words_to_now(a.expires_at) %></td>
21
+ <td><%= link_to "Switch!",
22
+ hello.session_path(a.id),
23
+ class: 'btn btn-xs btn-block btn-success' unless is_current_access?(a) %></td>
24
+ <td><%= button_to "Forget",
25
+ hello.session_path(a.id),
26
+ method: :delete,
27
+ class: 'btn btn-xs btn-block btn-danger',
28
+ data: { confirm: 'Are you sure?' } %></td>
29
+ </tr>
30
+ <% end %>
31
+ <tr>
32
+ <td colspan="4"></td>
33
+ <td colspan="2"><%= link_to "Add Account", hello.new_session_path, class: 'btn btn-xs btn-block btn-info' %></td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
@@ -0,0 +1,3 @@
1
+ <h2 class="page-header">Sign In</h2>
2
+
3
+ <%= render 'hello/authentication/sign_in' %>
@@ -0,0 +1,37 @@
1
+ <div class="row">
2
+ <%= render '/hello/shared/settings' %>
3
+
4
+ <div class="col-sm-3-offset col-md-2-offset col-sm-9 col-md-10">
5
+ <div class="panel panel-danger">
6
+ <div class="panel-heading">Confirm Password to Continue</div>
7
+ <div class="panel-body">
8
+
9
+ <%= form_for current_user, url: hello.sudo_mode_path, html: {class: "form-horizontal", role: "form"} do |f| %>
10
+
11
+ <div class="form-group">
12
+ <%= f.label :username, class: "col-sm-4 control-label" %>
13
+ <div class="col-sm-4">
14
+ <span class="form-control" style="border: 0px; box-shadow: none">
15
+ <%= current_user.username %>
16
+ </span>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :password, class: "col-sm-4 control-label" %>
22
+ <div class="col-sm-4">
23
+ <%= f.password_field :password, class: "form-control", placeholder: "Password" %>
24
+ </div>
25
+ </div>
26
+ <div class="form-group">
27
+ <div class="col-sm-offset-4 col-sm-4">
28
+ <%= f.submit "Confirm Password", class: "btn btn-danger" %>
29
+ </div>
30
+ </div>
31
+ <% end %>
32
+ </div>
33
+
34
+ </div>
35
+ </div>
36
+
37
+ </div>
@@ -0,0 +1,7 @@
1
+ <h1>Choose your language</h1>
2
+
3
+ <ul>
4
+ <% available_locales_with_names.each do |locale, name| %>
5
+ <li style="margin: 10px"><%= button_to name, hello.locale_path(locale: locale) %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,12 @@
1
+ <h1>Confirm this email address</h1>
2
+
3
+ <p>Hello <%= @user.name %>,</p>
4
+ <p>Confirm this email address on the link bellow</p>
5
+
6
+ <p><%= '-' * 40 %></p>
7
+ <p><%= link_to @url, @url %></p>
8
+ <p><%= '-' * 40 %></p>
9
+
10
+ <p>Awesome Regards,</p>
11
+ <p>Awesome Team</p>
12
+ <p>Awesome Site</p>
@@ -0,0 +1,12 @@
1
+ <h1>Reset Your Password</h1>
2
+
3
+ <p>Hello <%= @user.name %>,</p>
4
+ <p>Reset your password on the link bellow</p>
5
+
6
+ <p><%= '-' * 40 %></p>
7
+ <p><%= link_to @url, @url %></p>
8
+ <p><%= '-' * 40 %></p>
9
+
10
+ <p>Awesome Regards,</p>
11
+ <p>Awesome Team</p>
12
+ <p>Awesome Site</p>
@@ -0,0 +1,11 @@
1
+ <h1>Welcome</h1>
2
+
3
+ <p>Hello <%= @user.name %>,</p>
4
+ <p>We hope you love our website :)</p>
5
+
6
+ <p>Your password is: "<%= @password %>", it has been encrypted for storage.</p>
7
+ <p>if you forget it, you will have to ask for a new password.</p>
8
+
9
+ <p>Awesome Regards,</p>
10
+ <p>Awesome Team</p>
11
+ <p>Awesome Site</p>
@@ -0,0 +1,47 @@
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
+ <table class="table table-condensed">
8
+ <thead>
9
+ <tr>
10
+ <th>#</th>
11
+ <th>Device</th>
12
+ <th>IP Address</th>
13
+ <th></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+
18
+
19
+ <% @accesses.each_with_index do |access, i| %>
20
+ <% is_current_access?(access).tap do |is_current_access| %>
21
+
22
+ <tr class="<%= 'success' if is_current_access %>">
23
+ <td>Device #<%= i+1 %></td>
24
+ <td><%= access.full_device_name %></td>
25
+ <td><%= access.ip %></td>
26
+ <td>
27
+ <% if is_current_access %>
28
+ [this device]
29
+ <% else %>
30
+ <%= button_to 'Unlink',
31
+ access,
32
+ method: :delete,
33
+ class: 'btn btn-danger',
34
+ data: { confirm: 'Are you sure?' } %>
35
+ <% end %>
36
+ </td>
37
+ </tr>
38
+
39
+ <% end %>
40
+ <% end %>
41
+
42
+
43
+ </tbody>
44
+ </table>
45
+
46
+ </div>
47
+ </div>
@@ -0,0 +1,14 @@
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
+ <h1>Cancel Account</h1>
8
+ <p>Are you sure you want to cancel your account?</p>
9
+
10
+ <p><%= button_to "Cancel my Account", hello.profile_path, method: :delete %></p>
11
+ <p><%= link_to "No, I want to stay", root_path %></p>
12
+
13
+ </div>
14
+ </div>
@@ -0,0 +1,84 @@
1
+
2
+ <div class="row">
3
+
4
+ <%= render '/hello/shared/settings' %>
5
+
6
+ <div class="col-sm-3-offset col-md-2-offset col-sm-9 col-md-10">
7
+
8
+ <table class="table table-bordered">
9
+ <tbody>
10
+ <% credentials.each do |credential| %>
11
+ <tr>
12
+ <td>
13
+ <%= credential.email %>
14
+ </td>
15
+ <td>
16
+
17
+
18
+
19
+ <% if credential.email_confirmed? %>
20
+ <span class="label label-success">
21
+ Confirmed
22
+ <%= time_ago_in_words credential.confirmed_at %>
23
+ ago
24
+ </span>
25
+ <% else %>
26
+ <%= button_to "Confirm", deliver_email_path(credential), class: "btn btn-block" %>
27
+ <% end %>
28
+
29
+
30
+
31
+ </td>
32
+ <td>
33
+
34
+
35
+ <% unless credential.email_confirmed? %>
36
+ <% if credential.email_delivered? %>
37
+ <span class="label label-info">
38
+ Last confirmation sent
39
+ <%= time_ago_in_words credential.email_delivered_at %>
40
+ ago
41
+ </span>
42
+ <% else %>
43
+ <span class="label label-warning">
44
+ Confirmation never sent
45
+ </span>
46
+ <% end %>
47
+ <% end %>
48
+
49
+
50
+
51
+ </td>
52
+ <td>
53
+ <%= button_to 'Remove', email_path(credential), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-block" %>
54
+ </td>
55
+ </tr>
56
+ <% end %>
57
+ <tr>
58
+
59
+
60
+
61
+ <%= form_for(@credential, url: emails_path) do |f| %>
62
+ <td>
63
+ <%= f.email_field :email, placeholder: "email@provider.com", class: "form-control" %>
64
+ </td>
65
+ <td>
66
+ <%= f.submit "Add Email", class: "btn btn-block" %>
67
+ </td>
68
+ <td colspan="2">
69
+ <% if @credential.first_error_message %>
70
+ <span class="label label-danger">
71
+ <%= @credential.first_error_message %>
72
+ </span>
73
+ <% end %>
74
+ </td>
75
+ <% end %>
76
+
77
+
78
+
79
+ </tr>
80
+ </tbody>
81
+ </table>
82
+
83
+ </div>
84
+ </div>