usman 0.2.3 → 0.2.5
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 +4 -4
- data/app/controllers/usman/api/v1/base_controller.rb +15 -0
- data/app/controllers/usman/api/v1/docs_base_controller.rb +25 -0
- data/app/controllers/usman/api/v1/docs_controller.rb +165 -0
- data/app/controllers/usman/api/v1/profile_controller.rb +60 -0
- data/app/controllers/usman/api/v1/registrations_controller.rb +159 -0
- data/app/controllers/usman/registration_devices_controller.rb +141 -0
- data/app/controllers/usman/registrations_controller.rb +68 -0
- data/app/helpers/usman/api_helper.rb +21 -36
- data/app/helpers/usman/authentication_helper.rb +1 -1
- data/app/models/device.rb +30 -3
- data/app/models/registration.rb +12 -3
- data/app/models/user.rb +54 -4
- data/app/services/usman/mobile_registration_service.rb +3 -5
- data/app/views/kuppayam/api/docs/_navigation.html.erb +43 -0
- data/app/views/usman/api/v1/docs/register/_neg_case_1.html.erb +46 -0
- data/app/views/usman/api/v1/docs/register/_neg_case_2.html.erb +39 -0
- data/app/views/usman/api/v1/docs/register/_neg_case_3.html.erb +47 -0
- data/app/views/usman/api/v1/docs/register/_pos_case_1.html.erb +65 -0
- data/app/views/usman/api/v1/docs/resend_otp/_neg_case_1.html.erb +30 -0
- data/app/views/usman/api/v1/docs/resend_otp/_pos_case_1.html.erb +31 -0
- data/app/views/usman/api/v1/docs/verify_otp/_neg_case_1.html.erb +34 -0
- data/app/views/usman/api/v1/docs/verify_otp/_neg_case_2.html.erb +39 -0
- data/app/views/usman/api/v1/docs/verify_otp/_neg_case_3.html.erb +33 -0
- data/app/views/usman/api/v1/docs/verify_otp/_pos_case_1.html.erb +35 -0
- data/app/views/usman/registration_devices/_form.html.erb +24 -0
- data/app/views/usman/registration_devices/_index.html.erb +80 -0
- data/app/views/usman/registration_devices/_row.html.erb +34 -0
- data/app/views/usman/registrations/_form.html.erb +23 -0
- data/app/views/usman/registrations/_index.html.erb +60 -0
- data/app/views/usman/registrations/_row.html.erb +24 -0
- data/app/views/usman/registrations/_show.html.erb +112 -0
- data/app/views/usman/registrations/index.html.erb +47 -0
- data/config/locales/usman/api.ar.yml +43 -0
- data/config/locales/usman/api.en.yml +43 -0
- data/config/locales/usman/authentication.ar.yml +14 -14
- data/config/locales/usman/authentication.en.yml +15 -18
- data/config/routes.rb +28 -9
- data/db/migrate/20170904080436_add_tac_accepted_at_to_devices.rb +5 -0
- data/db/migrate/20170905041104_add_gender_to_users.rb +6 -0
- data/lib/usman/version.rb +1 -1
- metadata +36 -15
- data/app/controllers/api/v1/base_controller.rb +0 -13
- data/app/controllers/api/v1/registrations_controller.rb +0 -115
- data/app/controllers/usman/docs_controller.rb +0 -41
- data/app/views/usman/docs/index.html.erb +0 -502
- data/app/views/usman/docs/register.html.erb +0 -0
- data/config/locales/usman/general.ar.yml +0 -5
- data/config/locales/usman/general.en.yml +0 -5
- data/config/locales/usman/mobile_registration.ar.yml +0 -26
- data/config/locales/usman/mobile_registration.en.yml +0 -26
@@ -1,28 +1,25 @@
|
|
1
1
|
en:
|
2
2
|
authentication:
|
3
|
-
login_required:
|
4
|
-
heading: "Login Required / Session Expired"
|
5
|
-
message: "You need to login to perform this action."
|
6
3
|
permission_denied:
|
7
|
-
|
8
|
-
|
4
|
+
heading: "Permission Denied"
|
5
|
+
message: "You don't have permission to perform this action"
|
9
6
|
session_expired:
|
10
|
-
|
11
|
-
|
7
|
+
heading: "Session Expired"
|
8
|
+
message: "Your session has been expired. Please sign in again"
|
12
9
|
invalid_login:
|
13
|
-
|
14
|
-
|
10
|
+
heading: "Invalid Login"
|
11
|
+
message: "Invalid Username/Email or password."
|
15
12
|
user_is_pending:
|
16
|
-
|
17
|
-
|
13
|
+
heading: "Account Pending"
|
14
|
+
message: "Your account is not yet approved, please contact administrator to activate your account"
|
18
15
|
user_is_suspended:
|
19
|
-
|
20
|
-
|
16
|
+
heading: "Account Suspended"
|
17
|
+
message: "Your account is suspended, please contact administrator"
|
21
18
|
logged_in:
|
22
|
-
|
23
|
-
|
19
|
+
heading: "Signed In"
|
20
|
+
message: "You have successfully signed in"
|
24
21
|
logged_out:
|
25
|
-
|
26
|
-
|
27
|
-
masquerade: "
|
22
|
+
heading: "Signed Out"
|
23
|
+
message: "You have successfully signed out"
|
24
|
+
masquerade: "لقد سجلت الدخول بنجاح - %{user}"
|
28
25
|
sign_in_back: "You have successfully signed in back as %{user}"
|
data/config/routes.rb
CHANGED
@@ -14,6 +14,10 @@ Usman::Engine.routes.draw do
|
|
14
14
|
get '/my_account', to: "my_account#index", as: :my_account
|
15
15
|
get '/dashboard/usman', to: "dashboard#index", as: :dashboard
|
16
16
|
|
17
|
+
resources :registrations, only: [:index, :show] do
|
18
|
+
resources :devices, :controller => "registration_devices"
|
19
|
+
end
|
20
|
+
|
17
21
|
resources :users do
|
18
22
|
member do
|
19
23
|
put :masquerade, as: :masquerade
|
@@ -34,19 +38,34 @@ Usman::Engine.routes.draw do
|
|
34
38
|
end
|
35
39
|
|
36
40
|
resources :permissions
|
37
|
-
|
41
|
+
|
38
42
|
namespace :api do
|
39
43
|
namespace :v1 do
|
40
|
-
|
41
|
-
|
42
|
-
post :
|
44
|
+
|
45
|
+
# Registrations
|
46
|
+
post :register, :controller => "registrations"
|
47
|
+
post :resend_otp, :controller => "registrations"
|
48
|
+
post :verify, :controller => "registrations"
|
49
|
+
post :accept_tac, :controller => "registrations"
|
50
|
+
|
51
|
+
# Profile
|
52
|
+
post :create_profile, :controller => "profile"
|
53
|
+
post :update_profile, :controller => "profile"
|
43
54
|
end
|
44
55
|
end
|
45
|
-
|
46
|
-
get '/api/v1/docs/usman', to: "docs#index", as: :docs_index
|
47
56
|
|
48
|
-
|
49
|
-
|
50
|
-
|
57
|
+
scope :docs do
|
58
|
+
namespace :api do
|
59
|
+
namespace :v1 do
|
60
|
+
get 'index', :controller => "docs"
|
61
|
+
get 'register', :controller => "docs"
|
62
|
+
get 'resend_otp', :controller => "docs"
|
63
|
+
get 'verify_otp', :controller => "docs"
|
64
|
+
get 'accept_tac', :controller => "docs"
|
65
|
+
get 'create_profile', :controller => "docs"
|
66
|
+
get 'update_profile', :controller => "docs"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
51
70
|
|
52
71
|
end
|
data/lib/usman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpvarma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,28 +90,28 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.1.
|
93
|
+
version: 0.1.10
|
94
94
|
type: :runtime
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0.1.
|
100
|
+
version: 0.1.10
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: pattana
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
105
|
- - "~>"
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: 0.1.
|
107
|
+
version: 0.1.4
|
108
108
|
type: :runtime
|
109
109
|
prerelease: false
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - "~>"
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 0.1.
|
114
|
+
version: 0.1.4
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: bcrypt
|
117
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -345,15 +345,19 @@ files:
|
|
345
345
|
- app/assets/images/ms-icon-310x310.png
|
346
346
|
- app/assets/images/ms-icon-70x70.png
|
347
347
|
- app/assets/sketches/logo.sketch
|
348
|
-
- app/controllers/api/v1/base_controller.rb
|
349
|
-
- app/controllers/api/v1/registrations_controller.rb
|
350
348
|
- app/controllers/usman/admin_controller.rb
|
349
|
+
- app/controllers/usman/api/v1/base_controller.rb
|
350
|
+
- app/controllers/usman/api/v1/docs_base_controller.rb
|
351
|
+
- app/controllers/usman/api/v1/docs_controller.rb
|
352
|
+
- app/controllers/usman/api/v1/profile_controller.rb
|
353
|
+
- app/controllers/usman/api/v1/registrations_controller.rb
|
351
354
|
- app/controllers/usman/application_controller.rb
|
352
355
|
- app/controllers/usman/dashboard_controller.rb
|
353
|
-
- app/controllers/usman/docs_controller.rb
|
354
356
|
- app/controllers/usman/features_controller.rb
|
355
357
|
- app/controllers/usman/my_account_controller.rb
|
356
358
|
- app/controllers/usman/permissions_controller.rb
|
359
|
+
- app/controllers/usman/registration_devices_controller.rb
|
360
|
+
- app/controllers/usman/registrations_controller.rb
|
357
361
|
- app/controllers/usman/resource_controller.rb
|
358
362
|
- app/controllers/usman/roles_controller.rb
|
359
363
|
- app/controllers/usman/sessions_controller.rb
|
@@ -378,14 +382,23 @@ files:
|
|
378
382
|
- app/uploaders/feature_image_uploader.rb
|
379
383
|
- app/uploaders/image_uploader.rb
|
380
384
|
- app/uploaders/profile_picture_uploader.rb
|
385
|
+
- app/views/kuppayam/api/docs/_navigation.html.erb
|
381
386
|
- app/views/layouts/kuppayam/_footer.html.erb
|
382
387
|
- app/views/layouts/kuppayam/_header.html.erb
|
383
388
|
- app/views/layouts/kuppayam/_navbar.html.erb
|
384
389
|
- app/views/layouts/kuppayam/_sidebar.html.erb
|
385
390
|
- app/views/layouts/kuppayam/profile.html.erb
|
391
|
+
- app/views/usman/api/v1/docs/register/_neg_case_1.html.erb
|
392
|
+
- app/views/usman/api/v1/docs/register/_neg_case_2.html.erb
|
393
|
+
- app/views/usman/api/v1/docs/register/_neg_case_3.html.erb
|
394
|
+
- app/views/usman/api/v1/docs/register/_pos_case_1.html.erb
|
395
|
+
- app/views/usman/api/v1/docs/resend_otp/_neg_case_1.html.erb
|
396
|
+
- app/views/usman/api/v1/docs/resend_otp/_pos_case_1.html.erb
|
397
|
+
- app/views/usman/api/v1/docs/verify_otp/_neg_case_1.html.erb
|
398
|
+
- app/views/usman/api/v1/docs/verify_otp/_neg_case_2.html.erb
|
399
|
+
- app/views/usman/api/v1/docs/verify_otp/_neg_case_3.html.erb
|
400
|
+
- app/views/usman/api/v1/docs/verify_otp/_pos_case_1.html.erb
|
386
401
|
- app/views/usman/dashboard/index.html.erb
|
387
|
-
- app/views/usman/docs/index.html.erb
|
388
|
-
- app/views/usman/docs/register.html.erb
|
389
402
|
- app/views/usman/features/_form.html.erb
|
390
403
|
- app/views/usman/features/_index.html.erb
|
391
404
|
- app/views/usman/features/_row.html.erb
|
@@ -398,6 +411,14 @@ files:
|
|
398
411
|
- app/views/usman/permissions/_row.html.erb
|
399
412
|
- app/views/usman/permissions/_show.html.erb
|
400
413
|
- app/views/usman/permissions/index.html.erb
|
414
|
+
- app/views/usman/registration_devices/_form.html.erb
|
415
|
+
- app/views/usman/registration_devices/_index.html.erb
|
416
|
+
- app/views/usman/registration_devices/_row.html.erb
|
417
|
+
- app/views/usman/registrations/_form.html.erb
|
418
|
+
- app/views/usman/registrations/_index.html.erb
|
419
|
+
- app/views/usman/registrations/_row.html.erb
|
420
|
+
- app/views/usman/registrations/_show.html.erb
|
421
|
+
- app/views/usman/registrations/index.html.erb
|
401
422
|
- app/views/usman/roles/_form.html.erb
|
402
423
|
- app/views/usman/roles/_index.html.erb
|
403
424
|
- app/views/usman/roles/_row.html.erb
|
@@ -414,12 +435,10 @@ files:
|
|
414
435
|
- app/views/usman/users/_row.html.erb
|
415
436
|
- app/views/usman/users/_show.html.erb
|
416
437
|
- app/views/usman/users/index.html.erb
|
438
|
+
- config/locales/usman/api.ar.yml
|
439
|
+
- config/locales/usman/api.en.yml
|
417
440
|
- config/locales/usman/authentication.ar.yml
|
418
441
|
- config/locales/usman/authentication.en.yml
|
419
|
-
- config/locales/usman/general.ar.yml
|
420
|
-
- config/locales/usman/general.en.yml
|
421
|
-
- config/locales/usman/mobile_registration.ar.yml
|
422
|
-
- config/locales/usman/mobile_registration.en.yml
|
423
442
|
- config/routes.rb
|
424
443
|
- db/data/dummy/features.csv
|
425
444
|
- db/data/dummy/permissions.csv
|
@@ -437,6 +456,8 @@ files:
|
|
437
456
|
- db/migrate/20170819113218_add_registration_id_to_users.rb
|
438
457
|
- db/migrate/20170819113219_create_devices.rb
|
439
458
|
- db/migrate/20170825020624_add_otp_verified_at_to_devices.rb
|
459
|
+
- db/migrate/20170904080436_add_tac_accepted_at_to_devices.rb
|
460
|
+
- db/migrate/20170905041104_add_gender_to_users.rb
|
440
461
|
- lib/tasks/usman/data.rake
|
441
462
|
- lib/tasks/usman/master_data.rake
|
442
463
|
- lib/temp/features.rake
|
@@ -1,115 +0,0 @@
|
|
1
|
-
module Api
|
2
|
-
module V1
|
3
|
-
class RegistrationsController < BaseController
|
4
|
-
|
5
|
-
skip_before_action :require_auth_token
|
6
|
-
|
7
|
-
def register
|
8
|
-
proc_code = Proc.new do
|
9
|
-
@reg_data = Usman::MobileRegistrationService.new(params)
|
10
|
-
@errors = @reg_data.errors
|
11
|
-
@success = false
|
12
|
-
if @errors[:heading].blank?
|
13
|
-
@success = true
|
14
|
-
@alert = {
|
15
|
-
heading: I18n.translate("mobile_registration.otp_sent.heading"),
|
16
|
-
message: I18n.translate("mobile_registration.otp_sent.message")
|
17
|
-
}
|
18
|
-
@data = {
|
19
|
-
registration: @reg_data.registration,
|
20
|
-
device: @reg_data.device
|
21
|
-
}
|
22
|
-
end
|
23
|
-
end
|
24
|
-
render_json_response(proc_code)
|
25
|
-
end
|
26
|
-
|
27
|
-
def resend_otp
|
28
|
-
proc_code = Proc.new do
|
29
|
-
@device = Device.where("uuid = ?", params[:uuid]).first
|
30
|
-
if @device
|
31
|
-
if @device.blocked?
|
32
|
-
@success = false
|
33
|
-
@errors = {
|
34
|
-
heading: I18n.translate("mobile_registration.device_blocked.heading"),
|
35
|
-
message: I18n.translate("mobile_registration.device_blocked.message"),
|
36
|
-
details: {}
|
37
|
-
}
|
38
|
-
else
|
39
|
-
valid, validation_errors = @device.resend_otp(params[:dialing_prefix], params[:mobile_number])
|
40
|
-
if valid
|
41
|
-
@success = true
|
42
|
-
@alert = {
|
43
|
-
heading: I18n.translate("mobile_registration.new_otp_sent.heading"),
|
44
|
-
message: I18n.translate("mobile_registration.new_otp_sent.message")
|
45
|
-
}
|
46
|
-
@data = {}
|
47
|
-
else
|
48
|
-
@success = false
|
49
|
-
@errors = {
|
50
|
-
heading: I18n.translate("mobile_registration.otp_not_matching.heading"),
|
51
|
-
message: I18n.translate("mobile_registration.otp_not_matching.message"),
|
52
|
-
details: validation_errors
|
53
|
-
}
|
54
|
-
end
|
55
|
-
end
|
56
|
-
else
|
57
|
-
@success = false
|
58
|
-
@errors = {
|
59
|
-
heading: I18n.translate("general.unexpected_failure.heading"),
|
60
|
-
message: I18n.translate("general.unexpected_failure.message"),
|
61
|
-
details: {
|
62
|
-
uuid: "is invalid"
|
63
|
-
}
|
64
|
-
}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
render_json_response(proc_code)
|
68
|
-
end
|
69
|
-
|
70
|
-
def verify
|
71
|
-
proc_code = Proc.new do
|
72
|
-
@device = Device.where("uuid = ?", params[:uuid]).first
|
73
|
-
if @device
|
74
|
-
if @device.blocked?
|
75
|
-
@success = false
|
76
|
-
@errors = {
|
77
|
-
heading: I18n.translate("mobile_registration.device_blocked.heading"),
|
78
|
-
message: I18n.translate("mobile_registration.device_blocked.message"),
|
79
|
-
details: {}
|
80
|
-
}
|
81
|
-
else
|
82
|
-
valid, validation_errors = @device.validate_otp(params[:otp], params[:dialing_prefix], params[:mobile_number])
|
83
|
-
if valid
|
84
|
-
@success = true
|
85
|
-
@alert = {
|
86
|
-
heading: I18n.translate("mobile_registration.verification_success.heading"),
|
87
|
-
message: I18n.translate("mobile_registration.verification_success.message")
|
88
|
-
}
|
89
|
-
@data = { api_token: @device.api_token }
|
90
|
-
else
|
91
|
-
@success = false
|
92
|
-
@errors = {
|
93
|
-
heading: I18n.translate("mobile_registration.otp_not_matching.heading"),
|
94
|
-
message: I18n.translate("mobile_registration.otp_not_matching.message"),
|
95
|
-
details: validation_errors
|
96
|
-
}
|
97
|
-
end
|
98
|
-
end
|
99
|
-
else
|
100
|
-
@success = false
|
101
|
-
@errors = {
|
102
|
-
heading: I18n.translate("general.unexpected_failure.heading"),
|
103
|
-
message: I18n.translate("general.unexpected_failure.message"),
|
104
|
-
details: {
|
105
|
-
uuid: "is invalid"
|
106
|
-
}
|
107
|
-
}
|
108
|
-
end
|
109
|
-
end
|
110
|
-
render_json_response(proc_code)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Usman
|
2
|
-
class DocsController < Kuppayam::BaseController
|
3
|
-
|
4
|
-
include Usman::AuthenticationHelper
|
5
|
-
|
6
|
-
layout 'kuppayam/docs'
|
7
|
-
|
8
|
-
before_action :current_user
|
9
|
-
|
10
|
-
def index
|
11
|
-
end
|
12
|
-
|
13
|
-
def register
|
14
|
-
end
|
15
|
-
|
16
|
-
def resend_otp
|
17
|
-
end
|
18
|
-
|
19
|
-
def verify
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def set_default_title
|
25
|
-
set_title("API Docs | #{params[:action].to_s.titleize}")
|
26
|
-
end
|
27
|
-
|
28
|
-
def breadcrumbs_configuration
|
29
|
-
{
|
30
|
-
heading: "API Documentation",
|
31
|
-
description: "Requests and response structures with examples",
|
32
|
-
links: [{name: "Index", link: docs_index_path, icon: 'fa-list'}]
|
33
|
-
}
|
34
|
-
end
|
35
|
-
|
36
|
-
def set_navs
|
37
|
-
set_nav("docs")
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|