snowman-io 0.0.6 → 0.1.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/lib/snowman-io.rb +5 -4
  4. data/lib/snowman-io/api.rb +6 -0
  5. data/lib/snowman-io/api/agent.rb +13 -6
  6. data/lib/snowman-io/api/apps.rb +2 -1
  7. data/lib/snowman-io/api/auth_helpers.rb +1 -1
  8. data/lib/snowman-io/api/checks.rb +7 -11
  9. data/lib/snowman-io/api/extra/meteor.rb +2 -2
  10. data/lib/snowman-io/api/friendship.rb +37 -0
  11. data/lib/snowman-io/api/invites.rb +85 -0
  12. data/lib/snowman-io/api/metrics.rb +11 -41
  13. data/lib/snowman-io/api/profile.rb +42 -0
  14. data/lib/snowman-io/api/users.rb +21 -155
  15. data/lib/snowman-io/loop/checks.rb +2 -42
  16. data/lib/snowman-io/loop/checks_perform.rb +46 -0
  17. data/lib/snowman-io/loop/main.rb +0 -18
  18. data/lib/snowman-io/migration.rb +8 -1
  19. data/lib/snowman-io/models/user.rb +3 -3
  20. data/lib/snowman-io/options.rb +2 -2
  21. data/lib/snowman-io/{report_mailer.rb → snow_mailer.rb} +18 -37
  22. data/lib/snowman-io/ui/assets/ui-d362f30d01b07ba93506380bca1f84c6.js +8 -0
  23. data/lib/snowman-io/ui/assets/{vendor-c22e2ccc87c9bc7609b95939c308bc7f.js → vendor-6bc0d5ff67eccfbd9b0903afd6cc1d52.js} +9 -9
  24. data/lib/snowman-io/ui/index.html +3 -3
  25. data/lib/snowman-io/utils.rb +5 -29
  26. data/lib/snowman-io/version.rb +1 -1
  27. data/lib/snowman-io/views/{report_mailer → snow_mailer}/check_triggered.html.erb +1 -1
  28. data/lib/snowman-io/views/{report_mailer → snow_mailer}/checks/_human_last_value_limit.html.erb +0 -0
  29. data/lib/snowman-io/views/{report_mailer → snow_mailer}/checks/_human_prev_day_datapoints_limit.html.erb +0 -0
  30. data/lib/snowman-io/views/{report_mailer → snow_mailer}/restore_password.html.erb +1 -1
  31. data/lib/snowman-io/views/{report_mailer → snow_mailer}/send_invite.html.erb +0 -4
  32. metadata +14 -12
  33. data/lib/snowman-io/reports.rb +0 -16
  34. data/lib/snowman-io/ui/assets/ui-d30809d0ae0a003d841fa95a352d624b.js +0 -9
  35. data/lib/snowman-io/views/report_mailer/daily_report.html.erb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d73db25f824921779ff4ca25cac4e2571556c2f
4
- data.tar.gz: 8527bd4a2d72ea9b4a9628b310f463b4c4beed80
3
+ metadata.gz: e582711a3847fef089ccfbc950dfbce1c36fe4fc
4
+ data.tar.gz: a1160bf7102d58dfce882ca37fe3d719fbad831b
5
5
  SHA512:
6
- metadata.gz: 9b7f173b5e743eed29fc6df94a191af470fa7760e39724bd6c5a635dfa944780defba9e4e70332ce4579a4e4fceb298cfa7d6e74ba45aa1452a063119ac1712b
7
- data.tar.gz: 1ade6d4213bc68b86af2544b6a1a59391c2ff5ffe344e32423e801be1d9725baea971626ae81875960d4e22c948258cdf1e4902a3e0218e34003dbc792fa7ece
6
+ metadata.gz: c8df6d214fae6b3bae1f27d09b208f4d17923875a156e123c1a21b3e2486998ae1b36b09862b5dceeb68e0a96fea35984cf6190d8d06080d4a151c566c7c4b11
7
+ data.tar.gz: 840be04724b4c5a727af9eb9ca0142e580124f4c0d0a30d46f1817a696bfc01daab0feb981da071f638d650a3dbbe03e3aa5f36215df53c7d2a2f88b34029bb5
@@ -1,6 +1,10 @@
1
1
  # SnowmanIO
2
2
 
3
- Version 0.0.6 - 2015.06.08
3
+ Version 0.1.0 - 2015.07.11
4
+ - Remove daily reports
5
+ - Cover almost all server code with specs
6
+
7
+ Version 0.0.6 - 2015.06.09
4
8
  - Need 4.2 actionmailer at least
5
9
 
6
10
  Version 0.0.5 - 2015.06.08
@@ -22,11 +22,10 @@ require "snowman-io/launcher"
22
22
  require "snowman-io/cli"
23
23
  require "snowman-io/web_server"
24
24
  require "snowman-io/aggregate"
25
- require "snowman-io/reports"
26
25
  require "snowman-io/loop/ping"
27
26
  require "snowman-io/loop/main"
28
27
  require "snowman-io/loop/checks"
29
- require "snowman-io/report_mailer"
28
+ require "snowman-io/snow_mailer"
30
29
  require "snowman-io/migration"
31
30
 
32
31
  require "snowman-io/models/concerns/tokenable"
@@ -42,7 +41,10 @@ require "snowman-io/models/following"
42
41
 
43
42
  ActionMailer::Base.raise_delivery_errors = true
44
43
  ActionMailer::Base.view_paths = File.dirname(__FILE__) + "/snowman-io/views"
45
- if ENV["DEV_MODE"].to_i == 1
44
+
45
+ if ENV["TEST_MODE"].to_i == 1
46
+ ActionMailer::Base.delivery_method = :test
47
+ elsif ENV["DEV_MODE"].to_i == 1
46
48
  Object.send(:remove_const, :Rails)
47
49
  require "letter_opener"
48
50
  ActionMailer::Base.add_delivery_method :letter_opener,
@@ -64,7 +66,6 @@ end
64
66
  module SnowmanIO
65
67
  BASE_URL_KEY = "base_url"
66
68
  FORCE_SSL_KEY = "force_ssl"
67
- NEXT_REPORT_DATE_KEY = "next_report_date"
68
69
 
69
70
  def self.logger
70
71
  @logger ||= Logger.new(STDERR)
@@ -9,6 +9,9 @@ require 'snowman-io/api/metrics'
9
9
  require 'snowman-io/api/checks'
10
10
  require 'snowman-io/api/agent'
11
11
  require 'snowman-io/api/fridge'
12
+ require 'snowman-io/api/invites'
13
+ require 'snowman-io/api/profile'
14
+ require 'snowman-io/api/friendship'
12
15
 
13
16
  module SnowmanIO
14
17
  module API
@@ -33,6 +36,9 @@ module SnowmanIO
33
36
 
34
37
  prefix :api
35
38
  mount Users
39
+ mount Invites
40
+ mount Profile
41
+ mount Friendship
36
42
  mount Apps
37
43
  mount Info
38
44
  mount Metrics
@@ -6,21 +6,28 @@ module SnowmanIO
6
6
  desc "Report metrics from agent"
7
7
  params do
8
8
  requires :token, type: String
9
- optional :metrics, type: Array
9
+ optional :metrics, type: Array do
10
+ requires :name, type: String
11
+ requires :kind, type: String
12
+ requires :value
13
+ end
10
14
  end
11
15
  post "metrics" do
12
- if app = App.where(token: params[:token]).first
13
- params[:metrics].each do |metric|
16
+ if app = App.where(token: permitted_params[:token]).first
17
+ processed = 0
18
+ accepted = 0
19
+ (permitted_params[:metrics] || []).each do |metric|
20
+ processed += 1
14
21
  if Metric.supported?(metric["kind"])
15
22
  app.register_metric_value(metric["name"], metric["kind"], metric["value"].to_f, Time.now)
23
+ accepted += 1
16
24
  end
17
25
  end
18
- "OK"
26
+ {status: "ok", processed: processed, accepted: accepted}
19
27
  else
20
- "WRONG APP"
28
+ {status: "rejected", reason: "WRONG APP"}
21
29
  end
22
30
  end
23
-
24
31
  end
25
32
  end
26
33
  end
@@ -36,7 +36,8 @@ module SnowmanIO
36
36
 
37
37
  desc "Deletes app"
38
38
  delete do
39
- Extra::Meteor.model_destroy(App, @app)
39
+ Extra::Meteor.model_destroy(@app)
40
+ {status: "ok"}
40
41
  end
41
42
  end
42
43
  end
@@ -22,7 +22,7 @@ module SnowmanIO
22
22
  # Code below grabbed from [Ruby on Rails](https://github.com/rails/rails)
23
23
  def authenticate_user_from_token
24
24
  authenticate_with_http_token do |token, options|
25
- # # Let use only token for authentication
25
+ # # Let use only token for authentication. It helps to keep session after email change.
26
26
  # user_email = options[:email]
27
27
  # user_email && User.where(email: user_email, authentication_token: token).first
28
28
  User.where(authentication_token: token).first
@@ -7,15 +7,15 @@ module SnowmanIO
7
7
  params do
8
8
  requires :check, type: Hash do
9
9
  requires :metric_id, type: String
10
+ requires :template, type: String
10
11
  requires :cmp, type: String
11
12
  requires :value, type: Float
12
- requires :template, type: String
13
13
  end
14
14
  end
15
15
  post do
16
16
  metric = Metric.find(permitted_params[:check][:metric_id])
17
17
  { check: metric.checks.create!(
18
- permitted_params[:check].to_h.except("metric_id").merge("user_id" => current_user._id)
18
+ permitted_params[:check].to_h.except("metric_id").merge("user_id" => current_user.id)
19
19
  ) }
20
20
  end
21
21
 
@@ -24,16 +24,12 @@ module SnowmanIO
24
24
  @check = Check.find(params[:id])
25
25
  end
26
26
 
27
- get do
28
- { check: @check }
29
- end
30
-
31
27
  params do
32
28
  requires :check, type: Hash do
33
29
  requires :metric_id, type: String
30
+ requires :template, type: String
34
31
  requires :cmp, type: String
35
32
  requires :value, type: Float
36
- requires :template, type: String
37
33
  end
38
34
  end
39
35
  put do
@@ -45,12 +41,12 @@ module SnowmanIO
45
41
  } }
46
42
  end
47
43
 
48
- put 'resolve' do
49
- { check: @check.tap { |m| m.update_attributes!(triggered: false) } }
44
+ delete do
45
+ Extra::Meteor.model_destroy(@check)
50
46
  end
51
47
 
52
- delete do
53
- Extra::Meteor.model_destroy(Check, @check)
48
+ put 'resolve' do
49
+ { check: @check.tap { |m| m.update_attributes!(triggered: false) } }
54
50
  end
55
51
  end
56
52
  end
@@ -35,8 +35,8 @@ module SnowmanIO
35
35
  end
36
36
  end
37
37
 
38
- def self.model_destroy(model, record)
39
- Deleted.create!(model_kind: model.to_s, model_id: record.id.to_s)
38
+ def self.model_destroy(record)
39
+ Deleted.create!(model_kind: record.class.to_s, model_id: record.id.to_s)
40
40
  record.destroy
41
41
  end
42
42
  end
@@ -0,0 +1,37 @@
1
+ module SnowmanIO
2
+ module API
3
+ class Friendship < Grape::API
4
+ before(&:authenticate!)
5
+
6
+ namespace :users do
7
+ desc "Follow user"
8
+ post ":id/follow" do
9
+ authenticate!
10
+ if user = User.where(id: params[:id]).first
11
+ current_user.follow!(user)
12
+ current_user.touch
13
+ user.touch
14
+ { users: [current_user, user] }
15
+ else
16
+ status 400
17
+ { status: "failed" }
18
+ end
19
+ end
20
+
21
+ desc "Unfollow user"
22
+ post ":id/unfollow" do
23
+ authenticate!
24
+ if user = User.where(id: params[:id]).first
25
+ current_user.unfollow!(user)
26
+ current_user.touch
27
+ user.touch
28
+ { users: [current_user, user] }
29
+ else
30
+ status 400
31
+ { status: "failed" }
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,85 @@
1
+ module SnowmanIO
2
+ module API
3
+ class Invites < Grape::API
4
+ namespace :users do
5
+ params do
6
+ requires :email, type: String
7
+ end
8
+ post "invite" do
9
+ authenticate!
10
+ if User.where(email: permitted_params[:email]).empty?
11
+ user = User.create!(
12
+ email: permitted_params[:email],
13
+ password: SecureRandom.hex,
14
+ status: "wait_invite"
15
+ )
16
+ user.invite!(current_user)
17
+ { user: user }
18
+ else
19
+ status 400
20
+ { message: "wrong invite request" }
21
+ end
22
+ end
23
+
24
+ post ":id/resend_invite" do
25
+ authenticate!
26
+ user = User.where(status: "wait_invite", id: params[:id]).first
27
+
28
+ if user && user.invite_token.present?
29
+ user.invite!(current_user)
30
+ { user: user }
31
+ else
32
+ status 400
33
+ { message: "wrong invite resend request" }
34
+ end
35
+ end
36
+
37
+ post ":id/cancel_invite" do
38
+ authenticate!
39
+ user = User.where(status: "wait_invite", id: params[:id]).first
40
+
41
+ if user && user.invite_token.present?
42
+ user.destroy
43
+ { status: "ok" }
44
+ else
45
+ status 400
46
+ { message: "wrong invite cancel request" }
47
+ end
48
+ end
49
+
50
+ params do
51
+ requires :token, type: String
52
+ end
53
+ post "check_invite" do
54
+ {
55
+ correct: !!(
56
+ permitted_params[:token].present? &&
57
+ User.where(status: "wait_invite", invite_token: permitted_params[:token]).first
58
+ )
59
+ }
60
+ end
61
+
62
+ params do
63
+ requires :token, type: String
64
+ requires :name, type: String
65
+ requires :password, type: String
66
+ end
67
+ post "accept_invite" do
68
+ token = permitted_params[:token]
69
+ if token.present? && (user = User.where(status: "wait_invite", invite_token: token).first)
70
+ user.update_attributes!(
71
+ name: permitted_params[:name],
72
+ password: permitted_params[:password],
73
+ status: "active",
74
+ invite_token: ""
75
+ )
76
+ { user: user }
77
+ else
78
+ status 400
79
+ { message: "SnowmanIO bad accept_invite request" }
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -4,42 +4,13 @@ module SnowmanIO
4
4
  before(&:authenticate!)
5
5
 
6
6
  namespace :metrics do
7
- params do
8
- requires :metric, type: Hash do
9
- requires :app_id, type: String
10
- requires :name, type: String
11
- requires :kind, type: String
12
- optional :metric_name, type: String
13
- end
14
- end
15
- post do
16
- app = App.find(permitted_params[:metric][:app_id])
17
- { metric: app.metrics.create!(permitted_params[:metric].to_h.except("app_id")) }
18
- end
19
-
20
7
  route_param :id do
21
8
  before do
22
9
  @metric = Metric.find(params[:id])
23
10
  end
24
11
 
25
- get do
26
- { metric: @metric }
27
- end
28
-
29
- params do
30
- requires :metric, type: Hash do
31
- requires :app_id, type: String
32
- requires :name, type: String
33
- requires :kind, type: String
34
- optional :metric_name, type: String
35
- end
36
- end
37
- put do
38
- { metric: @metric.tap { |m| m.update_attributes!(permitted_params[:metric].to_h.except("app_id")) } }
39
- end
40
-
41
12
  delete do
42
- Extra::Meteor.model_destroy(Metric, @metric)
13
+ Extra::Meteor.model_destroy(@metric)
43
14
  end
44
15
 
45
16
  # Returns data to render chart for metric
@@ -66,22 +37,21 @@ module SnowmanIO
66
37
  { datapoints: datapoints }
67
38
 
68
39
  else
69
- if params[:duration] == "history"
70
- from = @metric.aggregations.where(precision: "daily").order_by("at" => "asc").first.try(:at)
71
- to = @metric.aggregations.where(precision: "daily").order_by("at" => "asc").last.try(:at)
72
- precision = "daily"
73
- delta = 1.day
74
- return { datapoints: [] } unless from && to
40
+ if params[:duration] == "hour"
41
+ to = Utils.floor_5min(Time.now)
42
+ from = to - 1.hour + 5.minutes
43
+ precision = "5min"
44
+ delta = 5.minutes
75
45
  elsif params[:duration] == "day"
76
46
  to = Time.now.beginning_of_hour
77
47
  from = to - 1.day + 1.hour
78
48
  precision = "hour"
79
49
  delta = 1.hour
80
- elsif params[:duration] == "hour"
81
- to = Utils.floor_5min(Time.now)
82
- from = to - 1.hour + 5.minutes
83
- precision = "5min"
84
- delta = 5.minutes
50
+ elsif params[:duration] == "history"
51
+ to = Time.now.beginning_of_day
52
+ from = @metric.aggregations.where(precision: "daily").order_by("at" => "asc").first.try(:at) || to
53
+ precision = "daily"
54
+ delta = 1.day
85
55
  end
86
56
 
87
57
  data = @metric.aggregations.where(
@@ -0,0 +1,42 @@
1
+ module SnowmanIO
2
+ module API
3
+ class Profile < Grape::API
4
+ before(&:authenticate!)
5
+
6
+ namespace :users do
7
+ params do
8
+ requires :name, type: String
9
+ end
10
+ post "profile/update_name" do
11
+ authenticate!
12
+ current_user.update_attributes!(name: permitted_params[:name])
13
+ { user: current_user }
14
+ end
15
+
16
+ params do
17
+ requires :email, type: String
18
+ end
19
+ post "profile/update_email" do
20
+ authenticate!
21
+ new_email = permitted_params[:email]
22
+ if User.ne(id: current_user.id).where(email: new_email).empty?
23
+ current_user.update_attributes!(email: new_email)
24
+ { user: current_user }
25
+ else
26
+ status 400
27
+ { message: "Duplicate email" }
28
+ end
29
+ end
30
+
31
+ params do
32
+ requires :password, type: String
33
+ end
34
+ post "profile/update_password" do
35
+ authenticate!
36
+ current_user.update_attributes!(password: permitted_params[:password])
37
+ { user: current_user }
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -20,38 +20,6 @@ module SnowmanIO
20
20
  end
21
21
  end
22
22
 
23
- params do
24
- requires :token, type: String
25
- end
26
- post "check_invite" do
27
- {
28
- correct: !!(
29
- permitted_params[:token].present? &&
30
- User.where(status: "wait_invite", invite_token: permitted_params[:token]).first
31
- )
32
- }
33
- end
34
-
35
- params do
36
- requires :token, type: String
37
- requires :name, type: String
38
- requires :password, type: String
39
- end
40
- post "accept_invite" do
41
- if permitted_params[:token].present? && (user = User.where(status: "wait_invite", invite_token: permitted_params[:token]).first)
42
- user.update_attributes!(
43
- name: permitted_params[:name],
44
- password: permitted_params[:password],
45
- status: "active",
46
- invite_token: ""
47
- )
48
- { user: user }
49
- else
50
- status 400
51
- { message: "SnowmanIO bad accept_invite request" }
52
- end
53
- end
54
-
55
23
  desc "User Signin"
56
24
  params do
57
25
  requires :user, type: Hash do
@@ -62,7 +30,7 @@ module SnowmanIO
62
30
  post "login" do
63
31
  email = permitted_params[:user][:email]
64
32
  password = permitted_params[:user][:password]
65
- if (user = User.where(email: email).first) && password.present? && user.authenticate(password)
33
+ if (user = User.where(status: "active", email: email).first) && password.present? && user.authenticate(password)
66
34
  { token: user.authentication_token, email: user.email, user_id: user.id.to_s }
67
35
  else
68
36
  status 400
@@ -74,21 +42,34 @@ module SnowmanIO
74
42
  requires :email, type: String
75
43
  end
76
44
  post "restore_password" do
77
- if user = User.where(email: permitted_params[:email]).first
45
+ if user = User.where(status: "active", email: permitted_params[:email]).first
78
46
  user.restore_password!
79
- {}
47
+ { status: "ok" }
80
48
  else
81
49
  status 400
82
50
  { message: "Unknown email" }
83
51
  end
84
52
  end
85
53
 
54
+ params do
55
+ requires :token, type: String
56
+ end
57
+ post "check_pass_token" do
58
+ {
59
+ correct: !!(
60
+ permitted_params[:token].present? &&
61
+ User.where(status: "active", restore_pass_token: permitted_params[:token]).first
62
+ )
63
+ }
64
+ end
65
+
86
66
  params do
87
67
  requires :token, type: String
88
68
  requires :password, type: String
89
69
  end
90
70
  post "reset_password" do
91
- if permitted_params[:token].present? && (user = User.where(status: "active", restore_pass_token: permitted_params[:token]).first)
71
+ token = permitted_params[:token]
72
+ if token.present? && (user = User.where(status: "active", restore_pass_token: token).first)
92
73
  user.update_attributes!(
93
74
  password: permitted_params[:password],
94
75
  restore_pass_token: ""
@@ -100,131 +81,16 @@ module SnowmanIO
100
81
  end
101
82
  end
102
83
 
103
- desc "Follow user"
104
- post ":id/follow" do
105
- authenticate!
106
- user = User.find(params[:id])
107
- current_user.follow!(user)
108
- user.touch
109
- current_user.touch
110
- { users: [current_user, user] }
111
- end
112
-
113
- desc "Unfollow user"
114
- post ":id/unfollow" do
115
- authenticate!
116
- user = User.find(params[:id])
117
- current_user.unfollow!(user)
118
- user.touch
119
- current_user.touch
120
- { users: [current_user, user] }
121
- end
122
-
123
84
  post ":id/destroy" do
124
85
  authenticate!
125
- user = User.find(params[:id])
126
- Extra::Meteor.model_destroy(User, user)
127
- { }
128
- end
129
-
130
- params do
131
- requires :email, type: String
132
- end
133
- post "invite" do
134
- authenticate!
135
- if User.where(email: permitted_params[:email]).empty?
136
- user = User.create!(
137
- email: permitted_params[:email],
138
- password: SecureRandom.hex,
139
- status: "wait_invite"
140
- )
141
- user.invite!(current_user)
142
- { user: user }
86
+ if user = User.where(id: params[:id]).first
87
+ Extra::Meteor.model_destroy(user)
88
+ { status: "ok"}
143
89
  else
144
90
  status 400
145
- { message: "wrong invite request" }
91
+ { status: "failed", message: "Wrong id" }
146
92
  end
147
93
  end
148
-
149
- post ":id/cancel_invite" do
150
- authenticate!
151
- user = User.where(status: "wait_invite").find(params[:id])
152
-
153
- if user.invite_token.present?
154
- user.destroy
155
- { }
156
- else
157
- status 400
158
- { message: "wrong invite cancel request" }
159
- end
160
- end
161
-
162
- post ":id/resend_invite" do
163
- authenticate!
164
- user = User.where(status: "wait_invite").find(params[:id])
165
-
166
- if user.invite_token.present?
167
- user.invite!(current_user)
168
- { user: user }
169
- else
170
- status 400
171
- { message: "wrong invite resend request" }
172
- end
173
- end
174
-
175
- params do
176
- requires :value, type: Boolean
177
- end
178
- post "profile/daily_report" do
179
- authenticate!
180
- current_user.update_attributes!(daily_report: permitted_params[:value])
181
- { user: current_user }
182
- end
183
-
184
- params do
185
- requires :name, type: String
186
- end
187
- post "profile/update_name" do
188
- authenticate!
189
- current_user.update_attributes!(name: permitted_params[:name])
190
- { user: current_user }
191
- end
192
-
193
- params do
194
- requires :email, type: String
195
- end
196
- post "profile/update_email" do
197
- authenticate!
198
- new_email = permitted_params[:email]
199
- if User.ne(_id: current_user._id).where(email: new_email).empty?
200
- current_user.update_attributes!(email: new_email)
201
- { user: current_user }
202
- else
203
- status 400
204
- { message: "Duplicate email" }
205
- end
206
- end
207
-
208
- params do
209
- requires :password, type: String
210
- end
211
- post "profile/update_password" do
212
- authenticate!
213
- current_user.update_attributes!(password: permitted_params[:password])
214
- { }
215
- end
216
-
217
- params do
218
- requires :token, type: String
219
- end
220
- post "check_pass_token" do
221
- {
222
- correct: !!(
223
- permitted_params[:token].present? &&
224
- User.where(status: "active", restore_pass_token: permitted_params[:token]).first
225
- )
226
- }
227
- end
228
94
  end
229
95
  end
230
96
  end