phcdevworks_accounts 3.1.2 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/users/omniauth_callbacks_controller.rb +1 -1
- data/app/controllers/users/registrations_controller.rb +57 -47
- data/app/models/phcdevworks_accounts/user.rb +4 -1
- data/app/views/layouts/phcdevworks_accounts/components/backend/sidebars/_side_menu.html.erb +67 -5
- data/app/views/phcdevworks_accounts/admin/pages/users_list.html.erb +5 -3
- data/app/views/users/registrations/new.html.erb +1 -1
- data/config/routes.rb +4 -3
- data/db/migrate/20210425060053_add_subscription_id_to_users.rb +7 -0
- data/lib/phcdevworks_accounts/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fa6206c2f7aa7b7aa3ba1005017bf67c379bd2b17d31544541f8992b4a402cd
|
4
|
+
data.tar.gz: bf68b68345ea2484af69fa6f45ba21e3ab90b343a8268f39db19a6766723e7af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11c626fa93ef009ff6ff9cda2fcd111d424b4e93db9fe4f76f0592d3fc124fa6c3e552af388872a1fc03938f090912411644d9a25a68bccbbae1fb17a4567faf
|
7
|
+
data.tar.gz: 46dedadbb7cf56cb0d5e94fca391e28c5604974c66c270086701566677e6b9a3baefe5424309b19c302014fc41c644f7e27d67c8f4d256bc7a421c816c3504a0
|
@@ -9,7 +9,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
9
9
|
# end
|
10
10
|
|
11
11
|
# More info at:
|
12
|
-
# https://github.com/
|
12
|
+
# https://github.com/heartcombo/devise#omniauth
|
13
13
|
|
14
14
|
# GET|POST /resource/auth/twitter
|
15
15
|
# def passthru
|
@@ -1,64 +1,74 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Users::RegistrationsController < Devise::RegistrationsController
|
4
|
+
# before_action :configure_sign_up_params, only: [:create]
|
5
|
+
# before_action :configure_account_update_params, only: [:update]
|
6
|
+
after_action :phcdevworks_accounts_payments_add_customer, :only => :create, if: -> {defined?(PhcdevworksAccountsStripe)}
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
# GET /resource/sign_up
|
9
|
+
# def new
|
10
|
+
# super
|
11
|
+
# end
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
13
|
+
# POST /resource
|
14
|
+
def create
|
15
|
+
super
|
16
|
+
end
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
# GET /resource/edit
|
19
|
+
# def edit
|
20
|
+
# super
|
21
|
+
# end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
# PUT /resource
|
24
|
+
# def update
|
25
|
+
# super
|
26
|
+
# end
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
# DELETE /resource
|
29
|
+
# def destroy
|
30
|
+
# super
|
31
|
+
# end
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
# GET /resource/cancel
|
34
|
+
# Forces the session data which is usually expired after sign
|
35
|
+
# in to be expired now. This is useful if the user wants to
|
36
|
+
# cancel oauth signing in/up in the middle of the process,
|
37
|
+
# removing all OAuth session data.
|
38
|
+
# def cancel
|
39
|
+
# super
|
40
|
+
# end
|
32
41
|
|
33
|
-
|
34
|
-
# Forces the session data which is usually expired after sign
|
35
|
-
# in to be expired now. This is useful if the user wants to
|
36
|
-
# cancel oauth signing in/up in the middle of the process,
|
37
|
-
# removing all OAuth session data.
|
38
|
-
# def cancel
|
39
|
-
# super
|
40
|
-
# end
|
42
|
+
# protected
|
41
43
|
|
42
|
-
|
44
|
+
# If you have extra params to permit, append them to the sanitizer.
|
45
|
+
# def configure_sign_up_params
|
46
|
+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
|
47
|
+
# end
|
43
48
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
# If you have extra params to permit, append them to the sanitizer.
|
50
|
+
# def configure_account_update_params
|
51
|
+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
52
|
+
# end
|
48
53
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
54
|
+
# The path used after sign up.
|
55
|
+
# def after_sign_up_path_for(resource)
|
56
|
+
# super(resource)
|
57
|
+
# end
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
# The path used after sign up for inactive accounts.
|
60
|
+
# def after_inactive_sign_up_path_for(resource)
|
61
|
+
# super(resource)
|
62
|
+
# end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
64
|
+
def phcdevworks_accounts_payments_add_customer
|
65
|
+
if resource.valid?
|
66
|
+
phcdevworks_accounts_customer = Stripe::Customer.create({
|
67
|
+
email: current_user.email, name: current_user.firstname + " " + current_user.lastname
|
68
|
+
})
|
69
|
+
@user.payments_customer_id = phcdevworks_accounts_customer.id
|
70
|
+
@user.save
|
71
|
+
end
|
72
|
+
end
|
63
73
|
|
64
74
|
end
|
@@ -14,7 +14,10 @@ module PhcdevworksAccounts
|
|
14
14
|
|
15
15
|
# Include default devise modules. Others available are:
|
16
16
|
# :trackable, :confirmable, :lockable and :omniauthable
|
17
|
-
devise :database_authenticatable, :registerable, :recoverable, :rememberable,
|
17
|
+
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :timeoutable
|
18
|
+
|
19
|
+
# Validations
|
20
|
+
validates :username, :presence => true, :uniqueness => true
|
18
21
|
|
19
22
|
private
|
20
23
|
|
@@ -277,14 +277,49 @@
|
|
277
277
|
<!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Core Modules -->
|
278
278
|
<% end %>
|
279
279
|
|
280
|
-
|
281
|
-
|
280
|
+
<% if current_user and current_user.admin? %>
|
281
|
+
<li class="nav-header">Administration</li>
|
282
|
+
<% if defined?phcdevworks_accounts_stripe and current_user.admin? %>
|
283
|
+
<!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
|
284
|
+
<li class="has-sub">
|
285
|
+
<a href="javascript:;">
|
286
|
+
<b class="caret"></b>
|
287
|
+
<i class="fab fa-cc-visa"></i>
|
288
|
+
<span>Accounting</span>
|
289
|
+
</a>
|
290
|
+
<ul class="sub-menu">
|
291
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Invoices", phcdevworks_accounts_stripe.admin_invoices_path) %></li>
|
292
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Subscriptions", phcdevworks_accounts_stripe.admin_subscriptions_path) %></li>
|
293
|
+
</ul>
|
294
|
+
</li>
|
295
|
+
<li class="has-sub">
|
296
|
+
<a href="javascript:;">
|
297
|
+
<b class="caret"></b>
|
298
|
+
<i class="fad fa-money-check-alt"></i>
|
299
|
+
<span>Services</span>
|
300
|
+
</a>
|
301
|
+
<ul class="sub-menu">
|
302
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_products_list") %>"><%= link_to("Product List", phcdevworks_accounts_stripe.admin_products_path) %></li>
|
303
|
+
</ul>
|
304
|
+
</li>
|
305
|
+
<li class="has-sub">
|
306
|
+
<a href="javascript:;">
|
307
|
+
<b class="caret"></b>
|
308
|
+
<i class="fad fa-users"></i>
|
309
|
+
<span>Customers</span>
|
310
|
+
</a>
|
311
|
+
<ul class="sub-menu">
|
312
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/customers#admin_customer_list") %>"><%= link_to("Customer List", phcdevworks_accounts_stripe.admin_customers_path) %></li>
|
313
|
+
</ul>
|
314
|
+
</li>
|
315
|
+
<!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
|
316
|
+
<% end %>
|
282
317
|
<!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
|
283
318
|
<li class="has-sub">
|
284
319
|
<a href="javascript:;">
|
285
320
|
<b class="caret"></b>
|
286
|
-
<i class="fad fa-user"></i>
|
287
|
-
<span>User
|
321
|
+
<i class="fad fa-user-lock"></i>
|
322
|
+
<span>User Logins</span>
|
288
323
|
</a>
|
289
324
|
<ul class="sub-menu">
|
290
325
|
<li class="<%= phc_menu_active_controller("phcdevworks_accounts/admin/users") %>"><%= link_to "User List", phcdevworks_accounts.admin_users_all_path %></li>
|
@@ -294,13 +329,40 @@
|
|
294
329
|
<% end %>
|
295
330
|
|
296
331
|
<li class="nav-header">Your Account</li>
|
332
|
+
<% if defined?phcdevworks_accounts_stripe and current_user %>
|
333
|
+
<!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
|
334
|
+
<li class="has-sub">
|
335
|
+
<a href="javascript:;">
|
336
|
+
<b class="caret"></b>
|
337
|
+
<i class="fad fa-money-check-alt"></i>
|
338
|
+
<span>Your Subscription</span>
|
339
|
+
</a>
|
340
|
+
<ul class="sub-menu">
|
341
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Your Subscription", phcdevworks_accounts_stripe.user_subscription_path) %></li>
|
342
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_product_list") %>"><%= link_to("Switch Subscriptions", phcdevworks_accounts_stripe.user_subscription_path) %></li>
|
343
|
+
</ul>
|
344
|
+
</li>
|
345
|
+
<li class="has-sub">
|
346
|
+
<a href="javascript:;">
|
347
|
+
<b class="caret"></b>
|
348
|
+
<i class="fad fa-file-invoice"></i>
|
349
|
+
<span>Your Invoices</span>
|
350
|
+
</a>
|
351
|
+
<ul class="sub-menu">
|
352
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Current Invoice", phcdevworks_accounts_stripe.user_invoices_path) %></li>
|
353
|
+
<li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Past Invoices", phcdevworks_accounts_stripe.admin_customers_path) %></li>
|
354
|
+
</ul>
|
355
|
+
</li>
|
356
|
+
<!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
|
357
|
+
<% end %>
|
358
|
+
|
297
359
|
<% if current_user %>
|
298
360
|
<!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts User Options -->
|
299
361
|
<li class="has-sub">
|
300
362
|
<a href="javascript:;">
|
301
363
|
<b class="caret"></b>
|
302
364
|
<i class="fad fa-user"></i>
|
303
|
-
<span>
|
365
|
+
<span>Login Settings</span>
|
304
366
|
</a>
|
305
367
|
<ul class="sub-menu">
|
306
368
|
<li class="<%= phc_menu_active_controller("phcdevworks_accounts/user/edit") %>"><%= link_to "Settings", phcdevworks_accounts.edit_user_registration_path %></li>
|
@@ -46,9 +46,11 @@
|
|
46
46
|
|
47
47
|
<tbody>
|
48
48
|
<% @admin_users.each do |user| %>
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
<tr>
|
50
|
+
<td><%= user.username %></td>
|
51
|
+
<td><%= user.firstname %> <%= user.lastname %></td>
|
52
|
+
<td><%= user.email %></td>
|
53
|
+
</tr>
|
52
54
|
<% end %>
|
53
55
|
</tbody>
|
54
56
|
|
@@ -67,7 +67,7 @@
|
|
67
67
|
<label class="control-label">Password Confirmation <span class="text-danger">*</span></label>
|
68
68
|
<div class="row m-b-15">
|
69
69
|
<div class="col-md-12">
|
70
|
-
<%= form.password_field :
|
70
|
+
<%= form.password_field :password_confirmation, autocomplete: "off", placeholder: "Confirm your Password", class: "form-control" %>
|
71
71
|
</div>
|
72
72
|
</div>
|
73
73
|
|
data/config/routes.rb
CHANGED
@@ -10,9 +10,10 @@ PhcdevworksAccounts::Engine.routes.draw do
|
|
10
10
|
match "/admin/user/:id", to: "admin/pages#user_profile", via: "get"
|
11
11
|
|
12
12
|
# User Routes
|
13
|
-
devise_for :users,
|
14
|
-
|
15
|
-
|
13
|
+
devise_for :users, class_name: "PhcdevworksAccounts::User",
|
14
|
+
module: :devise,
|
15
|
+
controllers: {
|
16
|
+
registrations: 'users/registrations'
|
16
17
|
}
|
17
18
|
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_accounts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -414,6 +414,7 @@ files:
|
|
414
414
|
- db/migrate/20191012060308_add_role_to_users.rb
|
415
415
|
- db/migrate/20191012060324_add_tos_to_users.rb
|
416
416
|
- db/migrate/20210407121952_add_customer_id_to_users.rb
|
417
|
+
- db/migrate/20210425060053_add_subscription_id_to_users.rb
|
417
418
|
- lib/phcdevworks_accounts.rb
|
418
419
|
- lib/phcdevworks_accounts/engine.rb
|
419
420
|
- lib/phcdevworks_accounts/version.rb
|