milia 1.3.1.beta1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/confirmations_controller.rb +1 -1
- data/app/controllers/registrations_controller.rb +13 -10
- data/lib/milia/base.rb +1 -0
- data/lib/milia/invite_member.rb +13 -13
- data/lib/milia/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27735e7a3f4034129b5c4b83b9a8d62b5806fd3
|
4
|
+
data.tar.gz: 31c951fbc829362f5c51b945d877a296e4852481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6411548d3151e57e5a4e7918a080726396bf99a7c01fbb5deace5a58462623cf3c1ce9095d4068f3bbdc712ce2c1360c71255c2687462993d5fe3a0206dd32
|
7
|
+
data.tar.gz: 9ffb6bf8f72e2d4034093c59f912f86e61b1c0b4711e5f06369fd58f54a31350965fe33383c4af03639d9e1364b7587d36a4ff7cc94ba9908f1b76ba3697365f
|
@@ -21,7 +21,7 @@ module Milia
|
|
21
21
|
|
22
22
|
if resource.errors.empty?
|
23
23
|
log_action( "invitee confirmed" )
|
24
|
-
set_flash_message(:notice, :confirmed)
|
24
|
+
set_flash_message(:notice, :confirmed)
|
25
25
|
# sign in automatically
|
26
26
|
sign_in_tenanted_and_redirect(resource)
|
27
27
|
|
@@ -104,30 +104,33 @@ end # def create
|
|
104
104
|
# same as in devise gem EXCEPT need to prep signup form variables
|
105
105
|
# ------------------------------------------------------------------------------
|
106
106
|
def devise_create( user_params )
|
107
|
-
|
108
107
|
build_resource(user_params)
|
109
108
|
|
110
|
-
|
109
|
+
# if we're using milia's invite_member helpers
|
111
110
|
if ::Milia.use_invite_member
|
112
|
-
|
111
|
+
# then flag for our confirmable that we won't need to set up a password
|
113
112
|
resource.skip_confirm_change_password = true
|
114
113
|
end
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
resource.save
|
116
|
+
yield resource if block_given?
|
117
|
+
log_action( "devise: signup user success", resource )
|
118
|
+
|
119
|
+
if resource.persisted?
|
119
120
|
if resource.active_for_authentication?
|
120
|
-
set_flash_message :notice, :signed_up
|
121
|
+
set_flash_message! :notice, :signed_up
|
121
122
|
sign_up(resource_name, resource)
|
122
|
-
respond_with resource, :
|
123
|
+
respond_with resource, location: after_sign_up_path_for(resource)
|
123
124
|
else
|
124
|
-
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}"
|
125
|
+
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
|
125
126
|
expire_data_after_sign_in!
|
126
|
-
respond_with resource, :
|
127
|
+
respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
127
128
|
end
|
128
129
|
else
|
130
|
+
# re-show signup view
|
129
131
|
clean_up_passwords resource
|
130
132
|
log_action( "devise: signup user failure", resource )
|
133
|
+
set_minimum_password_length
|
131
134
|
prep_signup_view( @tenant, resource, params[:coupon] )
|
132
135
|
respond_with resource
|
133
136
|
end
|
data/lib/milia/base.rb
CHANGED
@@ -90,6 +90,7 @@ module Milia
|
|
90
90
|
after_create do |new_user|
|
91
91
|
tenant = Tenant.find(Thread.current[:tenant_id])
|
92
92
|
unless tenant.users.include?(new_user)
|
93
|
+
new_user.skip_reconfirmation! # For details why this is needed see milia issue #68
|
93
94
|
tenant.users << new_user # add user to this tenant if not already there
|
94
95
|
end
|
95
96
|
end # before_create do
|
data/lib/milia/invite_member.rb
CHANGED
@@ -3,7 +3,7 @@ module Milia
|
|
3
3
|
module InviteMember
|
4
4
|
|
5
5
|
# #############################################################################
|
6
|
-
|
6
|
+
|
7
7
|
def self.included(base)
|
8
8
|
base.extend ClassMethods
|
9
9
|
end
|
@@ -11,13 +11,13 @@ module Milia
|
|
11
11
|
# #############################################################################
|
12
12
|
# #############################################################################
|
13
13
|
module ClassMethods
|
14
|
-
|
14
|
+
|
15
15
|
end # module ClassMethods
|
16
16
|
# #############################################################################
|
17
17
|
# #############################################################################
|
18
18
|
|
19
19
|
# ------------------------------------------------------------------------
|
20
|
-
# new function to set the password without knowing the current password
|
20
|
+
# new function to set the password without knowing the current password
|
21
21
|
# ------------------------------------------------------------------------
|
22
22
|
def attempt_set_password(params)
|
23
23
|
p = {}
|
@@ -32,7 +32,7 @@ module Milia
|
|
32
32
|
def has_no_password?
|
33
33
|
self.encrypted_password.blank?
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
# ------------------------------------------------------------------------
|
37
37
|
# new function to provide access to protected method unless_confirmed
|
38
38
|
# ------------------------------------------------------------------------
|
@@ -43,35 +43,35 @@ module Milia
|
|
43
43
|
# ------------------------------------------------------------------------
|
44
44
|
# ------------------------------------------------------------------------
|
45
45
|
|
46
|
-
# ------------------------------------------------------------------------
|
46
|
+
# ------------------------------------------------------------------------
|
47
47
|
# save_and_invite_member -- saves the new user record thus inviting member
|
48
48
|
# via devise
|
49
49
|
# if password missing; gens a password
|
50
50
|
# ensures email exists and that email is unique and not already in system
|
51
|
-
# ------------------------------------------------------------------------
|
52
|
-
def save_and_invite_member
|
51
|
+
# ------------------------------------------------------------------------
|
52
|
+
def save_and_invite_member
|
53
53
|
status = nil
|
54
54
|
|
55
55
|
if (self.email.blank?)
|
56
56
|
self.errors.add(:email, :blank)
|
57
57
|
elsif User.where([ "lower(email) = ?", self.email.downcase ]).present?
|
58
58
|
self.errors.add(:email, :taken)
|
59
|
-
|
60
|
-
|
59
|
+
else
|
60
|
+
check_or_set_password()
|
61
61
|
status = self.save && self.errors.empty?
|
62
62
|
end
|
63
63
|
|
64
64
|
return status
|
65
65
|
end
|
66
66
|
|
67
|
-
# ------------------------------------------------------------------------
|
67
|
+
# ------------------------------------------------------------------------
|
68
68
|
# check_or_set_password -- if password missing, generates a password
|
69
69
|
# ASSUMES: Milia.use_invite_member
|
70
|
-
# ------------------------------------------------------------------------
|
71
|
-
def check_or_set_password
|
70
|
+
# ------------------------------------------------------------------------
|
71
|
+
def check_or_set_password
|
72
72
|
|
73
73
|
if self.password.blank?
|
74
|
-
self.password =
|
74
|
+
self.password =
|
75
75
|
::Milia::Password.generate(
|
76
76
|
8, Password::ONE_DIGIT | Password::ONE_CASE
|
77
77
|
)
|
data/lib/milia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.1
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dsaronin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -57,44 +57,44 @@ dependencies:
|
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
62
|
+
version: '12.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
69
|
+
version: '12.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: shoulda
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '3.5'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '3.5'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: turn
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
90
|
+
version: '0.9'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
97
|
+
version: '0.9'
|
98
98
|
description: Transparent multi-tenanting for web applications based on Rails and Devise
|
99
99
|
email:
|
100
100
|
- jekuno@users.noreply.github.com
|
@@ -135,12 +135,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- - "
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.10
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Easy multi-tenanting for Rails + Devise
|