phcdevworks_accounts 3.1.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6315d5f5baa05787f1ed1281e3a555e99d834b3dac019a1a33498c3b605052e
4
- data.tar.gz: ad76c5ffeea3c921bff37507a0ad731222054a8457b2517aae3d71a72a9617a8
3
+ metadata.gz: b2093924da8575dc57bdaf811cddc71451d3878ce9792c59d0a6b8a664cda05d
4
+ data.tar.gz: bf612d14ae462d489c7037579097191518cf152acb9963359b64cb62ef7b3a69
5
5
  SHA512:
6
- metadata.gz: 01ee9f22630a96de5f857036aa430096bb4c80b9c29f6fb1372ee01d06405eee5226ed00c0456d47d50dc777826770d90baa511dfe757fcd59f960bda33bf889
7
- data.tar.gz: 2315010b2e5c7d071d5dfe94fe6058e240b88a112738b4b2dfd5cbd8d0b6458b7c452b3b96f76578d973466c6aef04417c1300b672223ef0c2b74ccbf4546bf0
6
+ metadata.gz: 866a2386fe6b0754a6c1d468136786bb34b17e7e1df03a961c33ed9f4e926babd06eec5c98a6cda3cacba07151e3bf128fb0a20ec64e7acec0ed418781dc7358
7
+ data.tar.gz: 4375a693a0ebb9e4e37c0936b70436d1159907d23ef36de386d32762199125fe62264e61c97da5874e234b8b9abbdfb9c4872eec31e192a0044ff0893e53237b
@@ -9,7 +9,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
9
9
  # end
10
10
 
11
11
  # More info at:
12
- # https://github.com/plataformatec/devise#omniauth
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
- # before_action :configure_sign_up_params, only: [:create]
6
- # before_action :configure_account_update_params, only: [:update]
8
+ # GET /resource/sign_up
9
+ # def new
10
+ # super
11
+ # end
7
12
 
8
- # GET /resource/sign_up
9
- # def new
10
- # super
11
- # end
13
+ # POST /resource
14
+ def create
15
+ super
16
+ end
12
17
 
13
- # POST /resource
14
- # def create
15
- # super
16
- # end
18
+ # GET /resource/edit
19
+ # def edit
20
+ # super
21
+ # end
17
22
 
18
- # GET /resource/edit
19
- # def edit
20
- # super
21
- # end
23
+ # PUT /resource
24
+ # def update
25
+ # super
26
+ # end
22
27
 
23
- # PUT /resource
24
- # def update
25
- # super
26
- # end
28
+ # DELETE /resource
29
+ # def destroy
30
+ # super
31
+ # end
27
32
 
28
- # DELETE /resource
29
- # def destroy
30
- # super
31
- # end
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
- # 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
42
+ # protected
41
43
 
42
- # protected
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
- # 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
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
- # 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
54
+ # The path used after sign up.
55
+ # def after_sign_up_path_for(resource)
56
+ # super(resource)
57
+ # end
53
58
 
54
- # The path used after sign up.
55
- # def after_sign_up_path_for(resource)
56
- # super(resource)
57
- # end
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
- # The path used after sign up for inactive accounts.
60
- # def after_inactive_sign_up_path_for(resource)
61
- # super(resource)
62
- # end
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, :validatable, :timeoutable
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,9 +277,9 @@
277
277
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Core Modules -->
278
278
  <% end %>
279
279
 
280
- <li class="nav-header">Administration</li>
281
280
  <% if current_user && current_user.admin? %>
282
281
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
282
+ <li class="nav-header">Administration</li>
283
283
  <li class="has-sub">
284
284
  <a href="javascript:;">
285
285
  <b class="caret"></b>
@@ -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 :password, autocomplete: "off", placeholder: "Confirm your Password", class: "form-control" %>
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
- class_name: "PhcdevworksAccounts::User",
15
- module: :devise
13
+ devise_for :users, class_name: "PhcdevworksAccounts::User",
14
+ module: :devise,
15
+ controllers: {
16
+ registrations: 'users/registrations'
16
17
  }
17
18
 
18
19
  end
@@ -1,3 +1,3 @@
1
1
  module PhcdevworksAccounts
2
- VERSION = "3.1.2"
2
+ VERSION = "3.2.0"
3
3
  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.1.2
4
+ version: 3.2.0
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-08 00:00:00.000000000 Z
11
+ date: 2021-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails