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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +97 -0
- data/Rakefile +23 -0
- data/app/controllers/hello/application_controller.rb +27 -0
- data/app/controllers/hello/authentication/sessions_controller.rb +81 -0
- data/app/controllers/hello/authentication/sign_in_controller.rb +39 -0
- data/app/controllers/hello/authentication/sudo_mode_controller.rb +40 -0
- data/app/controllers/hello/concerns/authentication/sign_in.rb +44 -0
- data/app/controllers/hello/concerns/management/forgot_password.rb +45 -0
- data/app/controllers/hello/concerns/management/reset_password.rb +33 -0
- data/app/controllers/hello/concerns/registration/sign_up.rb +64 -0
- data/app/controllers/hello/internationalization/locale_controller.rb +28 -0
- data/app/controllers/hello/management/accesses_controller.rb +29 -0
- data/app/controllers/hello/management/confirm_emails_controller.rb +41 -0
- data/app/controllers/hello/management/emails_controller.rb +67 -0
- data/app/controllers/hello/management/forgot_password_controller.rb +41 -0
- data/app/controllers/hello/management/passwords_controller.rb +57 -0
- data/app/controllers/hello/management/profiles_controller.rb +71 -0
- data/app/controllers/hello/management/reset_password_controller.rb +53 -0
- data/app/controllers/hello/registration/sign_up_controller.rb +63 -0
- data/app/helpers/hello/application_helper.rb +5 -0
- data/app/mailers/hello/mailer.rb +26 -0
- data/app/models/access.rb +2 -0
- data/app/models/credential.rb +2 -0
- data/app/models/email_credential.rb +2 -0
- data/app/models/password_credential.rb +2 -0
- data/app/models/user.rb +2 -0
- data/app/views/hello/authentication/_sign_in.html.erb +64 -0
- data/app/views/hello/authentication/new_session.html.erb +4 -0
- data/app/views/hello/authentication/sessions.html.erb +36 -0
- data/app/views/hello/authentication/sign_in.html.erb +3 -0
- data/app/views/hello/authentication/sudo_mode.html.erb +37 -0
- data/app/views/hello/internationalization/locales.html.erb +7 -0
- data/app/views/hello/mailer/confirm_email.html.erb +12 -0
- data/app/views/hello/mailer/forgot_password.html.erb +12 -0
- data/app/views/hello/mailer/welcome.html.erb +11 -0
- data/app/views/hello/management/accesses.html.erb +47 -0
- data/app/views/hello/management/cancel.html.erb +14 -0
- data/app/views/hello/management/email_credentials/expired_confirmation_token.html.erb +1 -0
- data/app/views/hello/management/email_credentials/index.html.erb +84 -0
- data/app/views/hello/management/password_credentials/_forgot_form.html.erb +17 -0
- data/app/views/hello/management/password_credentials/_reset_form.html.erb +39 -0
- data/app/views/hello/management/password_credentials/forgot.html.erb +10 -0
- data/app/views/hello/management/password_credentials/forgot_success.html.erb +26 -0
- data/app/views/hello/management/password_credentials/reset.html.erb +3 -0
- data/app/views/hello/management/password_credentials/show.html.erb +25 -0
- data/app/views/hello/management/user.html.erb +73 -0
- data/app/views/hello/registration/_sign_up.html.erb +86 -0
- data/app/views/hello/registration/sign_up.html.erb +3 -0
- data/app/views/hello/registration/sign_up_widget.html.erb +3 -0
- data/app/views/hello/shared/_errors.html.erb +11 -0
- data/app/views/hello/shared/_flash.html.erb +8 -0
- data/app/views/hello/shared/_nav_pills.html.erb +15 -0
- data/app/views/hello/shared/_session_expiration.html.erb +15 -0
- data/app/views/hello/shared/_settings.html.erb +41 -0
- data/config/locales/hello.en.yml +69 -0
- data/config/locales/hello.es.yml +71 -0
- data/config/locales/hello.fr.yml +71 -0
- data/config/locales/hello.pl.yml +71 -0
- data/config/locales/hello.pt-BR.yml +71 -0
- data/config/locales/hello.zh-CN.yml +71 -0
- data/config/locales/hello.zh-TW.yml +71 -0
- data/config/routes.rb +74 -0
- data/db/migrate/1_create_credentials.rb +17 -0
- data/db/migrate/2_create_accesses.rb +15 -0
- data/db/migrate/3_create_users.rb +23 -0
- data/lib/generators/hello/concerns/USAGE +8 -0
- data/lib/generators/hello/concerns/concerns_generator.rb +10 -0
- data/lib/generators/hello/from_devise/USAGE +8 -0
- data/lib/generators/hello/from_devise/from_devise_generator.rb +13 -0
- data/lib/generators/hello/from_devise/templates/from_devise.migration.rb +39 -0
- data/lib/generators/hello/install/USAGE +8 -0
- data/lib/generators/hello/install/install_generator.rb +94 -0
- data/lib/generators/hello/install/templates/application.html.erb +35 -0
- data/lib/generators/hello/install/templates/hello_helper.rb +16 -0
- data/lib/generators/hello/install/templates/initializer.rb +24 -0
- data/lib/generators/hello/install/templates/models/concerns/user/authorization.rb +21 -0
- data/lib/generators/hello/install/templates/models/user.rb +9 -0
- data/lib/generators/hello/install/templates/onboarding/index.html.erb +5 -0
- data/lib/generators/hello/install/templates/onboarding/onboarding_controller.rb +33 -0
- data/lib/generators/hello/install/templates/root/index.html.erb +7 -0
- data/lib/generators/hello/install/templates/root/root_controller.rb +6 -0
- data/lib/generators/hello/install/templates/users/controllers/users_controller.rb +71 -0
- data/lib/generators/hello/install/templates/users/views/users/index.html.erb +29 -0
- data/lib/generators/hello/install/templates/users/views/users/list.html.erb +35 -0
- data/lib/generators/hello/install/templates/users/views/users/new.html.erb +60 -0
- data/lib/generators/hello/install/templates/users/views/users/show.html.erb +74 -0
- data/lib/generators/hello/locales/USAGE +12 -0
- data/lib/generators/hello/locales/locales_generator.rb +64 -0
- data/lib/generators/hello/views/USAGE +8 -0
- data/lib/generators/hello/views/views_generator.rb +9 -0
- data/lib/hello-rails.rb +1 -0
- data/lib/hello.rb +36 -0
- data/lib/hello/CHANGES.md +26 -0
- data/lib/hello/business.rb +47 -0
- data/lib/hello/business/authentication/sign_in.rb +92 -0
- data/lib/hello/business/authentication/sign_out.rb +8 -0
- data/lib/hello/business/authentication/sudo_mode_authentication.rb +25 -0
- data/lib/hello/business/authentication/sudo_mode_expiration.rb +17 -0
- data/lib/hello/business/base.rb +33 -0
- data/lib/hello/business/internationalization/update_locale.rb +33 -0
- data/lib/hello/business/management/add_email.rb +19 -0
- data/lib/hello/business/management/cancel_account.rb +22 -0
- data/lib/hello/business/management/confirm_email.rb +36 -0
- data/lib/hello/business/management/forgot_password.rb +47 -0
- data/lib/hello/business/management/remove_email.rb +19 -0
- data/lib/hello/business/management/reset_password.rb +34 -0
- data/lib/hello/business/management/send_confirmation_email.rb +40 -0
- data/lib/hello/business/management/unlink_access.rb +8 -0
- data/lib/hello/business/management/update_profile.rb +44 -0
- data/lib/hello/business/registration/sign_up.rb +159 -0
- data/lib/hello/configuration.rb +12 -0
- data/lib/hello/encryptors.rb +6 -0
- data/lib/hello/encryptors/complex.rb +25 -0
- data/lib/hello/encryptors/simple.rb +27 -0
- data/lib/hello/engine.rb +23 -0
- data/lib/hello/errors.rb +12 -0
- data/lib/hello/locales.rb +238 -0
- data/lib/hello/middleware.rb +13 -0
- data/lib/hello/rails_active_record.rb +10 -0
- data/lib/hello/rails_active_record/access.rb +65 -0
- data/lib/hello/rails_active_record/credential.rb +51 -0
- data/lib/hello/rails_active_record/email_credential.rb +60 -0
- data/lib/hello/rails_active_record/password_credential.rb +70 -0
- data/lib/hello/rails_active_record/user.rb +99 -0
- data/lib/hello/rails_controller.rb +124 -0
- data/lib/hello/rails_controller/restrict_by_role.rb +79 -0
- data/lib/hello/rails_helper.rb +35 -0
- data/lib/hello/request_manager.rb +14 -0
- data/lib/hello/request_manager/abstract.rb +77 -0
- data/lib/hello/request_manager/factory.rb +32 -0
- data/lib/hello/request_manager/stateful.rb +53 -0
- data/lib/hello/request_manager/stateful/finder.rb +58 -0
- data/lib/hello/request_manager/stateful/session_wrapper.rb +37 -0
- data/lib/hello/request_manager/stateless.rb +35 -0
- data/lib/hello/time_zones.rb +7 -0
- data/lib/hello/utils.rb +11 -0
- data/lib/hello/utils/device_name.rb +34 -0
- data/lib/hello/version.rb +4 -0
- data/lib/tasks/hello_tasks.rake +4 -0
- data/spec/bdd/hello/authentication/authorization/authorization_role_restriction_spec.rb +291 -0
- data/spec/bdd/hello/authentication/authorization/authorization_router_constraints_spec.rb +41 -0
- data/spec/bdd/hello/authentication/authorization/authorization_sensitive_restriction_spec.rb +84 -0
- data/spec/bdd/hello/authentication/authorization/bdd.yml +1 -0
- data/spec/bdd/hello/authentication/bdd.yml +1 -0
- data/spec/bdd/hello/authentication/classic_sign_in_spec.rb +264 -0
- data/spec/bdd/hello/authentication/manage_sessions_spec.rb +292 -0
- data/spec/bdd/hello/authentication/sign_out_spec.rb +159 -0
- data/spec/bdd/hello/bdd.yml +1 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/bdd.yml +1 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_locale_page_spec.rb +90 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_profile_page_spec.rb +64 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_sign_in_form_spec.rb +31 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_sign_up_form_spec.rb +34 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/bdd.yml +1 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_profile_page_spec.rb +14 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_sign_in_form_spec.rb +14 -0
- data/spec/bdd/hello/internalionalization/anyone_can_change_their_timezone/change_timezone_on_the_sign_up_form_spec.rb +14 -0
- data/spec/bdd/hello/internalionalization/bdd.yml +1 -0
- data/spec/bdd/hello/management/bdd.yml +1 -0
- data/spec/bdd/hello/management/cancel_account_spec.rb +128 -0
- data/spec/bdd/hello/management/manage_email_credentials/bdd.yml +1 -0
- data/spec/bdd/hello/management/manage_email_credentials/manage_email_credentials_emails_api_spec.rb +7 -0
- data/spec/bdd/hello/management/manage_email_credentials/manage_email_credentials_emails_page_spec.rb +252 -0
- data/spec/bdd/hello/management/manage_password_credentials/bdd.yml +1 -0
- data/spec/bdd/hello/management/manage_password_credentials/manage_password_forgot_password_spec.rb +68 -0
- data/spec/bdd/hello/management/manage_password_credentials/manage_password_page_spec.rb +60 -0
- data/spec/bdd/hello/management/manage_password_credentials/manage_password_reset_password_spec.rb +145 -0
- data/spec/bdd/hello/management/manage_profile/bdd.yml +1 -0
- data/spec/bdd/hello/management/manage_profile/manage_profile_api_spec.rb +7 -0
- data/spec/bdd/hello/management/manage_profile/manage_profile_page_spec.rb +65 -0
- data/spec/bdd/hello/management/manage_social_credentials/bdd.yml +1 -0
- data/spec/bdd/hello/management/manage_social_credentials/manage_social_credentials_pending_spec.rb +7 -0
- data/spec/bdd/hello/management/unlink_sessions_spec.rb +59 -0
- data/spec/bdd/hello/other/bdd.yml +1 -0
- data/spec/bdd/hello/other/create_user_spec.rb +70 -0
- data/spec/bdd/hello/other/impersonate_user_spec.rb +58 -0
- data/spec/bdd/hello/other/list_users_spec.rb +86 -0
- data/spec/bdd/hello/registration/bdd.yml +1 -0
- data/spec/bdd/hello/registration/classic_sign_up_spec.rb +228 -0
- data/spec/bdd/hello/registration/onboarding_process_spec.rb +101 -0
- data/spec/bdd/hello/support.rb +62 -0
- data/spec/business/hello/authentication/sign_in_spec.rb +72 -0
- data/spec/business/hello/registration/sign_up_spec.rb +258 -0
- data/spec/controllers/authentication_spec.rb +97 -0
- data/spec/controllers/localization_spec.rb +65 -0
- data/spec/controllers/request_can_carry_an_access_token_spec.rb +223 -0
- data/spec/fixtures/hello/password_mailer/confirmation +3 -0
- data/spec/fixtures/hello/password_mailer/forgot +3 -0
- data/spec/fixtures/hello/password_mailer/sign_up +3 -0
- data/spec/mailers/hello/mailer_spec.rb +53 -0
- data/spec/models/access_spec.rb +19 -0
- data/spec/models/credential_spec.rb +9 -0
- data/spec/models/email_credential_spec.rb +163 -0
- data/spec/models/hello/sign_up_model_spec.rb +64 -0
- data/spec/models/password_credential_spec.rb +75 -0
- data/spec/models/user_spec.rb +93 -0
- data/spec/others/configuration_spec.rb +25 -0
- data/spec/others/encryptors/complex_spec.rb +26 -0
- data/spec/others/encryptors/simple_spec.rb +21 -0
- data/spec/others/helper_spec.rb +10 -0
- data/spec/others/localization_consistency_spec.rb +73 -0
- data/spec/requests/forgot_password_spec.rb +36 -0
- data/spec/requests/reset_password_spec.rb +7 -0
- data/spec/requests/security/user_spec.rb +19 -0
- data/spec/routing/hello/accesses_routing_spec.rb +17 -0
- data/spec/routing/hello/emails_routing_spec.rb +37 -0
- data/spec/routing/hello/locale_routing_spec.rb +17 -0
- data/spec/routing/hello/profile_routing_spec.rb +29 -0
- data/spec/routing/hello/registration_routing_spec.rb +23 -0
- data/spec/routing/hello/sign_out_routing_spec.rb +11 -0
- data/spec/routing/hello/sudo_mode_routing_spec.rb +23 -0
- data/spec/routing/hello/users_routing_spec.rb +15 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/spec_helper/codeclimate.rb +2 -0
- data/spec/spec_helper/configure_rspec.rb +23 -0
- data/spec/spec_helper/create_database.rb +5 -0
- data/spec/spec_helper/dummy_and_test_dependencies.rb +17 -0
- data/spec/spec_helper/support.rb +1 -0
- data/spec/support/factories.rb +60 -0
- data/spec/support/feature_injection.rb +118 -0
- data/spec/support/features/feature_support_given.rb +46 -0
- data/spec/support/features/feature_support_then.rb +43 -0
- data/spec/support/helpers/aliases.rb +76 -0
- data/spec/support/helpers/configuration.rb +6 -0
- data/spec/support/helpers/current.rb +16 -0
- data/spec/support/helpers/expect.rb +61 -0
- data/spec/support/helpers/given.rb +49 -0
- data/spec/support/helpers/shortcuts.rb +24 -0
- data/spec/support/helpers/then.rb +29 -0
- data/spec/support/helpers/when.rb +108 -0
- data/spec/support/requests/request_support.rb +8 -0
- data/spec/utils/device_name_spec.rb +228 -0
- 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,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
|
data/app/models/user.rb
ADDED
@@ -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,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,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,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 @@
|
|
1
|
+
.
|
@@ -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>
|