meroku 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +2 -0
- data/Guardfile +7 -18
- data/README.md +78 -4
- data/bin/meroku +1 -1
- data/frontend/.gitignore +23 -0
- data/frontend/.ruby-version +2 -0
- data/frontend/Gemfile +58 -0
- data/frontend/Gemfile.lock +233 -0
- data/frontend/README.md +24 -0
- data/frontend/Rakefile +6 -0
- data/frontend/app/assets/config/manifest.js +3 -0
- data/frontend/app/assets/images/.keep +0 -0
- data/frontend/app/assets/javascripts/application.js +15 -0
- data/frontend/app/assets/javascripts/apps.coffee +3 -0
- data/frontend/app/assets/javascripts/cable.js +13 -0
- data/frontend/app/assets/javascripts/channels/.keep +0 -0
- data/frontend/app/assets/javascripts/pages.coffee +3 -0
- data/frontend/app/assets/javascripts/publickeys.coffee +3 -0
- data/frontend/app/assets/stylesheets/application.css +15 -0
- data/frontend/app/assets/stylesheets/apps.scss +3 -0
- data/frontend/app/assets/stylesheets/pages.scss +3 -0
- data/frontend/app/assets/stylesheets/publickeys.scss +3 -0
- data/frontend/app/assets/stylesheets/scaffolds.scss +84 -0
- data/frontend/app/channels/application_cable/channel.rb +4 -0
- data/frontend/app/channels/application_cable/connection.rb +4 -0
- data/frontend/app/controllers/application_controller.rb +3 -0
- data/frontend/app/controllers/apps_controller.rb +85 -0
- data/frontend/app/controllers/concerns/.keep +0 -0
- data/frontend/app/controllers/pages_controller.rb +4 -0
- data/frontend/app/controllers/publickeys_controller.rb +76 -0
- data/frontend/app/controllers/users/confirmations_controller.rb +28 -0
- data/frontend/app/controllers/users/omniauth_callbacks_controller.rb +28 -0
- data/frontend/app/controllers/users/passwords_controller.rb +32 -0
- data/frontend/app/controllers/users/registrations_controller.rb +89 -0
- data/frontend/app/controllers/users/sessions_controller.rb +25 -0
- data/frontend/app/controllers/users/unlocks_controller.rb +28 -0
- data/frontend/app/helpers/application_helper.rb +2 -0
- data/frontend/app/helpers/apps_helper.rb +2 -0
- data/frontend/app/helpers/pages_helper.rb +2 -0
- data/frontend/app/helpers/publickeys_helper.rb +2 -0
- data/frontend/app/jobs/application_job.rb +2 -0
- data/frontend/app/mailers/application_mailer.rb +4 -0
- data/frontend/app/models/app.rb +3 -0
- data/frontend/app/models/application_record.rb +3 -0
- data/frontend/app/models/concerns/.keep +0 -0
- data/frontend/app/models/publickey.rb +3 -0
- data/frontend/app/models/user.rb +12 -0
- data/frontend/app/serializable/serializable_app.rb +6 -0
- data/frontend/app/serializable/serializable_publickey.rb +7 -0
- data/frontend/app/serializable/serializable_user.rb +7 -0
- data/frontend/app/serializers/app_serializer.rb +3 -0
- data/frontend/app/serializers/publickey_serializer.rb +4 -0
- data/frontend/app/views/apps/_app.json.jbuilder +2 -0
- data/frontend/app/views/apps/_form.html.erb +22 -0
- data/frontend/app/views/apps/edit.html.erb +6 -0
- data/frontend/app/views/apps/index.html.erb +27 -0
- data/frontend/app/views/apps/index.json.jbuilder +1 -0
- data/frontend/app/views/apps/new.html.erb +5 -0
- data/frontend/app/views/apps/show.html.erb +9 -0
- data/frontend/app/views/apps/show.json.jbuilder +1 -0
- data/frontend/app/views/devise/confirmations/new.html.erb +16 -0
- data/frontend/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/frontend/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/frontend/app/views/devise/mailer/password_change.html.erb +3 -0
- data/frontend/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/frontend/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/frontend/app/views/devise/passwords/edit.html.erb +25 -0
- data/frontend/app/views/devise/passwords/new.html.erb +16 -0
- data/frontend/app/views/devise/registrations/edit.html.erb +43 -0
- data/frontend/app/views/devise/registrations/new.html.erb +29 -0
- data/frontend/app/views/devise/sessions/new.html.erb +26 -0
- data/frontend/app/views/devise/shared/_links.html.erb +25 -0
- data/frontend/app/views/devise/unlocks/new.html.erb +16 -0
- data/frontend/app/views/layouts/application.html.erb +16 -0
- data/frontend/app/views/layouts/mailer.html.erb +13 -0
- data/frontend/app/views/layouts/mailer.text.erb +1 -0
- data/frontend/app/views/pages/landing.html.erb +2 -0
- data/frontend/app/views/publickeys/_form.html.erb +32 -0
- data/frontend/app/views/publickeys/_publickey.json.jbuilder +2 -0
- data/frontend/app/views/publickeys/edit.html.erb +6 -0
- data/frontend/app/views/publickeys/index.html.erb +31 -0
- data/frontend/app/views/publickeys/index.json.jbuilder +1 -0
- data/frontend/app/views/publickeys/new.html.erb +5 -0
- data/frontend/app/views/publickeys/show.html.erb +19 -0
- data/frontend/app/views/publickeys/show.json.jbuilder +1 -0
- data/frontend/bin/bundle +3 -0
- data/frontend/bin/rails +9 -0
- data/frontend/bin/rake +9 -0
- data/frontend/bin/setup +38 -0
- data/frontend/bin/spring +17 -0
- data/frontend/bin/update +29 -0
- data/frontend/bin/yarn +11 -0
- data/frontend/config.ru +5 -0
- data/frontend/config/application.rb +18 -0
- data/frontend/config/boot.rb +3 -0
- data/frontend/config/cable.yml +10 -0
- data/frontend/config/database.yml +25 -0
- data/frontend/config/environment.rb +5 -0
- data/frontend/config/environments/development.rb +56 -0
- data/frontend/config/environments/production.rb +97 -0
- data/frontend/config/environments/test.rb +42 -0
- data/frontend/config/initializers/ams.rb +3 -0
- data/frontend/config/initializers/application_controller_renderer.rb +8 -0
- data/frontend/config/initializers/assets.rb +14 -0
- data/frontend/config/initializers/backtrace_silencers.rb +7 -0
- data/frontend/config/initializers/cookies_serializer.rb +5 -0
- data/frontend/config/initializers/devise.rb +277 -0
- data/frontend/config/initializers/filter_parameter_logging.rb +4 -0
- data/frontend/config/initializers/inflections.rb +16 -0
- data/frontend/config/initializers/mime_types.rb +4 -0
- data/frontend/config/initializers/wrap_parameters.rb +14 -0
- data/frontend/config/locales/devise.en.yml +64 -0
- data/frontend/config/locales/en.yml +33 -0
- data/frontend/config/puma.rb +66 -0
- data/frontend/config/routes.rb +19 -0
- data/frontend/config/secrets.yml +32 -0
- data/frontend/config/spring.rb +6 -0
- data/frontend/db/migrate/20171023223732_devise_create_users.rb +42 -0
- data/frontend/db/migrate/20171025193627_add_token_to_users.rb +5 -0
- data/frontend/db/migrate/20171025203706_create_apps.rb +9 -0
- data/frontend/db/migrate/20171025223804_add_user_to_apps.rb +5 -0
- data/frontend/db/migrate/20171026071440_create_publickeys.rb +11 -0
- data/frontend/db/schema.rb +32 -0
- data/frontend/db/seeds.rb +7 -0
- data/frontend/etc_nginx_sites-available_default +29 -0
- data/frontend/lib/assets/.keep +0 -0
- data/frontend/lib/tasks/.keep +0 -0
- data/frontend/log/.keep +0 -0
- data/frontend/package.json +5 -0
- data/frontend/public/404.html +67 -0
- data/frontend/public/422.html +67 -0
- data/frontend/public/500.html +66 -0
- data/frontend/public/apple-touch-icon-precomposed.png +0 -0
- data/frontend/public/apple-touch-icon.png +0 -0
- data/frontend/public/favicon.ico +0 -0
- data/frontend/public/robots.txt +1 -0
- data/frontend/test/application_system_test_case.rb +5 -0
- data/frontend/test/controllers/.keep +0 -0
- data/frontend/test/controllers/apps_controller_test.rb +48 -0
- data/frontend/test/controllers/pages_controller_test.rb +9 -0
- data/frontend/test/controllers/publickeys_controller_test.rb +48 -0
- data/frontend/test/fixtures/.keep +0 -0
- data/frontend/test/fixtures/apps.yml +7 -0
- data/frontend/test/fixtures/files/.keep +0 -0
- data/frontend/test/fixtures/publickeys.yml +11 -0
- data/frontend/test/fixtures/users.yml +11 -0
- data/frontend/test/helpers/.keep +0 -0
- data/frontend/test/integration/.keep +0 -0
- data/frontend/test/mailers/.keep +0 -0
- data/frontend/test/models/.keep +0 -0
- data/frontend/test/models/app_test.rb +7 -0
- data/frontend/test/models/publickey_test.rb +7 -0
- data/frontend/test/models/user_test.rb +7 -0
- data/frontend/test/system/.keep +0 -0
- data/frontend/test/system/apps_test.rb +9 -0
- data/frontend/test/system/publickeys_test.rb +9 -0
- data/frontend/test/test_helper.rb +9 -0
- data/frontend/tmp/.keep +0 -0
- data/frontend/vendor/.keep +0 -0
- data/lib/meroku.rb +11 -24
- data/lib/meroku/aws.rb +32 -0
- data/lib/meroku/cli.rb +131 -0
- data/lib/meroku/infrastructure.rb +10 -17
- data/lib/meroku/infrastructure/node.rb +68 -0
- data/lib/meroku/tunnel.rb +50 -0
- data/lib/meroku/version.rb +1 -1
- data/meroku.gemspec +7 -3
- data/modified-cedar-14.sh +175 -0
- metadata +222 -19
@@ -0,0 +1,32 @@
|
|
1
|
+
class Users::PasswordsController < Devise::PasswordsController
|
2
|
+
# GET /resource/password/new
|
3
|
+
# def new
|
4
|
+
# super
|
5
|
+
# end
|
6
|
+
|
7
|
+
# POST /resource/password
|
8
|
+
# def create
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# GET /resource/password/edit?reset_password_token=abcdef
|
13
|
+
# def edit
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# PUT /resource/password
|
18
|
+
# def update
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# protected
|
23
|
+
|
24
|
+
# def after_resetting_password_path_for(resource)
|
25
|
+
# super(resource)
|
26
|
+
# end
|
27
|
+
|
28
|
+
# The path used after sending reset password instructions
|
29
|
+
# def after_sending_reset_password_instructions_path_for(resource_name)
|
30
|
+
# super(resource_name)
|
31
|
+
# end
|
32
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class Users::RegistrationsController < Devise::RegistrationsController
|
2
|
+
#protect_from_forgery with: :null_session
|
3
|
+
skip_before_action :verify_authenticity_token
|
4
|
+
respond_to :json
|
5
|
+
|
6
|
+
# before_action :configure_sign_up_params, only: [:create]
|
7
|
+
# before_action :configure_account_update_params, only: [:update]
|
8
|
+
|
9
|
+
# GET /resource/sign_up
|
10
|
+
# def new
|
11
|
+
# super
|
12
|
+
# end
|
13
|
+
|
14
|
+
# POST /resource
|
15
|
+
def create
|
16
|
+
#super
|
17
|
+
build_resource(sign_up_params)
|
18
|
+
|
19
|
+
resource.save
|
20
|
+
yield resource if block_given?
|
21
|
+
if resource.persisted?
|
22
|
+
#render jsonapi: resource
|
23
|
+
render jsonapi: resource
|
24
|
+
#if resource.active_for_authentication?
|
25
|
+
# set_flash_message! :notice, :signed_up
|
26
|
+
# sign_up(resource_name, resource)
|
27
|
+
# respond_with resource, location: after_sign_up_path_for(resource)
|
28
|
+
#else
|
29
|
+
# set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
|
30
|
+
# expire_data_after_sign_in!
|
31
|
+
# respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
32
|
+
#end
|
33
|
+
else
|
34
|
+
clean_up_passwords resource
|
35
|
+
set_minimum_password_length
|
36
|
+
##respond_with resource
|
37
|
+
#warden.custom_failure!
|
38
|
+
#render :json=> resource.errors, :status=>422
|
39
|
+
render jsonapi_errors: resource.errors
|
40
|
+
#render json: {status: 'SUCCESS', message: resource.errors.full_messages}, status: 422
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# GET /resource/edit
|
45
|
+
# def edit
|
46
|
+
# super
|
47
|
+
# end
|
48
|
+
|
49
|
+
# PUT /resource
|
50
|
+
# def update
|
51
|
+
# super
|
52
|
+
# end
|
53
|
+
|
54
|
+
# DELETE /resource
|
55
|
+
# def destroy
|
56
|
+
# super
|
57
|
+
# end
|
58
|
+
|
59
|
+
# GET /resource/cancel
|
60
|
+
# Forces the session data which is usually expired after sign
|
61
|
+
# in to be expired now. This is useful if the user wants to
|
62
|
+
# cancel oauth signing in/up in the middle of the process,
|
63
|
+
# removing all OAuth session data.
|
64
|
+
# def cancel
|
65
|
+
# super
|
66
|
+
# end
|
67
|
+
|
68
|
+
# protected
|
69
|
+
|
70
|
+
# If you have extra params to permit, append them to the sanitizer.
|
71
|
+
# def configure_sign_up_params
|
72
|
+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
|
73
|
+
# end
|
74
|
+
|
75
|
+
# If you have extra params to permit, append them to the sanitizer.
|
76
|
+
# def configure_account_update_params
|
77
|
+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
78
|
+
# end
|
79
|
+
|
80
|
+
# The path used after sign up.
|
81
|
+
# def after_sign_up_path_for(resource)
|
82
|
+
# super(resource)
|
83
|
+
# end
|
84
|
+
|
85
|
+
# The path used after sign up for inactive accounts.
|
86
|
+
# def after_inactive_sign_up_path_for(resource)
|
87
|
+
# super(resource)
|
88
|
+
# end
|
89
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Users::SessionsController < Devise::SessionsController
|
2
|
+
# before_action :configure_sign_in_params, only: [:create]
|
3
|
+
|
4
|
+
# GET /resource/sign_in
|
5
|
+
# def new
|
6
|
+
# super
|
7
|
+
# end
|
8
|
+
|
9
|
+
# POST /resource/sign_in
|
10
|
+
# def create
|
11
|
+
# super
|
12
|
+
# end
|
13
|
+
|
14
|
+
# DELETE /resource/sign_out
|
15
|
+
# def destroy
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# protected
|
20
|
+
|
21
|
+
# If you have extra params to permit, append them to the sanitizer.
|
22
|
+
# def configure_sign_in_params
|
23
|
+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
|
24
|
+
# end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Users::UnlocksController < Devise::UnlocksController
|
2
|
+
# GET /resource/unlock/new
|
3
|
+
# def new
|
4
|
+
# super
|
5
|
+
# end
|
6
|
+
|
7
|
+
# POST /resource/unlock
|
8
|
+
# def create
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# GET /resource/unlock?unlock_token=abcdef
|
13
|
+
# def show
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# protected
|
18
|
+
|
19
|
+
# The path used after sending unlock password instructions
|
20
|
+
# def after_sending_unlock_instructions_path_for(resource)
|
21
|
+
# super(resource)
|
22
|
+
# end
|
23
|
+
|
24
|
+
# The path used after unlocking the resource
|
25
|
+
# def after_unlock_path_for(resource)
|
26
|
+
# super(resource)
|
27
|
+
# end
|
28
|
+
end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class User < ApplicationRecord
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :confirmable, :lockable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable, :registerable,
|
5
|
+
:recoverable, :rememberable, :trackable, :validatable
|
6
|
+
|
7
|
+
has_many :publickeys
|
8
|
+
|
9
|
+
before_save do
|
10
|
+
self.token = SecureRandom.hex if !self.token
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_with(model: app, local: true) do |form| %>
|
2
|
+
<% if app.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(app.errors.count, "error") %> prohibited this app from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% app.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= form.label :name %>
|
16
|
+
<%= form.text_field :name, id: :app_name %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="actions">
|
20
|
+
<%= form.submit %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Apps</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th colspan="3"></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @apps.each do |app| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= app.name %></td>
|
17
|
+
<td><%= link_to 'Show', app %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_app_path(app) %></td>
|
19
|
+
<td><%= link_to 'Destroy', app, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br>
|
26
|
+
|
27
|
+
<%= link_to 'New App', new_app_path %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @apps, partial: 'apps/app', as: :app
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! "apps/app", app: @app
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Resend confirmation instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @email %>!</p>
|
2
|
+
|
3
|
+
<% if @resource.try(:unconfirmed_email?) %>
|
4
|
+
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
5
|
+
<% else %>
|
6
|
+
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
7
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label :password, "New password" %><br />
|
9
|
+
<% if @minimum_password_length %>
|
10
|
+
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
11
|
+
<% end %>
|
12
|
+
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
17
|
+
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="actions">
|
21
|
+
<%= f.submit "Change my password" %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render "devise/shared/links" %>
|