usman 0.3.3 → 0.3.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62800b6f073efd50739af97e19089839e9356b0d
|
4
|
+
data.tar.gz: 8aa69a51f5b800ae068f22a60fbc4d169a584913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bda771ec286d380b5d87f8661b559dc15c37d6b86b3b5ba3c9b3189f4acf5b19f95fff9179ee462efdaac5d84d57eddb01c4f9fb707bca372ee685fbb4e17b3
|
7
|
+
data.tar.gz: c0f413d6bdadf9439fb047ba9b36a9cf26a432eb5f358d3d9738759a8a17ba6d47ab7289ca3a0ab35d9b4d2b0557536b706ecff74a5e63ca0c41acdac71390f9
|
@@ -19,12 +19,13 @@ module Usman
|
|
19
19
|
@user.gender = permitted_params[:gender]
|
20
20
|
@user.date_of_birth = permitted_params[:date_of_birth]
|
21
21
|
@user.email = permitted_params[:email]
|
22
|
-
|
22
|
+
|
23
23
|
@country = Country.find_by_id(permitted_params[:country_id])
|
24
24
|
@city = City.find_by_id(permitted_params[:city_id])
|
25
25
|
|
26
26
|
if @user.valid?
|
27
27
|
@user.save
|
28
|
+
@user.approve!
|
28
29
|
@current_registration.user = @user
|
29
30
|
|
30
31
|
@current_registration.country = @country if @country
|
@@ -3,6 +3,20 @@ module Usman
|
|
3
3
|
|
4
4
|
before_action :require_site_admin
|
5
5
|
|
6
|
+
def update_status
|
7
|
+
@user = @r_object = User.find(params[:id])
|
8
|
+
case params[:status]
|
9
|
+
when "pending"
|
10
|
+
@user.pending!
|
11
|
+
when "approved"
|
12
|
+
@user.approve!
|
13
|
+
when "suspended"
|
14
|
+
@user.suspend!
|
15
|
+
end
|
16
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: @r_object.status))
|
17
|
+
render_row
|
18
|
+
end
|
19
|
+
|
6
20
|
def make_super_admin
|
7
21
|
@user = @r_object = User.find(params[:id])
|
8
22
|
if @user
|
@@ -44,8 +44,8 @@ module Usman
|
|
44
44
|
proc_code = Proc.new do
|
45
45
|
@success = false
|
46
46
|
@errors = {
|
47
|
-
heading: I18n.translate("api.
|
48
|
-
message: I18n.translate("api.
|
47
|
+
heading: I18n.translate("api.authentication.user_is_pending.heading"),
|
48
|
+
message: I18n.translate("api.authentication.user_is_pending.message")
|
49
49
|
}
|
50
50
|
end
|
51
51
|
render_json_response(proc_code)
|
@@ -54,8 +54,8 @@ module Usman
|
|
54
54
|
proc_code = Proc.new do
|
55
55
|
@success = false
|
56
56
|
@errors = {
|
57
|
-
heading: I18n.translate("api.
|
58
|
-
message: I18n.translate("api.
|
57
|
+
heading: I18n.translate("api.authentication.user_is_suspended.heading"),
|
58
|
+
message: I18n.translate("api.authentication.user_is_suspended.message")
|
59
59
|
}
|
60
60
|
end
|
61
61
|
render_json_response(proc_code)
|
data/app/models/device.rb
CHANGED
@@ -168,9 +168,7 @@ class Device < ApplicationRecord
|
|
168
168
|
self.save
|
169
169
|
|
170
170
|
self.verify!
|
171
|
-
|
172
|
-
self.registration.user.approve! if self.registration.user
|
173
|
-
|
171
|
+
|
174
172
|
# Clearing the OTP so that next time if he uses the same, it shows error
|
175
173
|
self.otp = nil
|
176
174
|
self.save
|
@@ -217,6 +215,12 @@ class Device < ApplicationRecord
|
|
217
215
|
self.tac_accepted_at = Time.now
|
218
216
|
self.save
|
219
217
|
|
218
|
+
# Verify the Registration as it is now complete
|
219
|
+
self.registration.verify!
|
220
|
+
|
221
|
+
# Approve the user if it not already approved
|
222
|
+
self.registration.user.approve! if self.registration.user
|
223
|
+
|
220
224
|
return true, {}
|
221
225
|
end
|
222
226
|
|
data/lib/usman/version.rb
CHANGED