touchpass 0.0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rspec +2 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +38 -0
- data/Guardfile +9 -0
- data/Rakefile +1 -0
- data/app/controllers/touchpass/verifications_controller.rb +30 -0
- data/bin/tpcli.rb +248 -0
- data/config/routes.rb +8 -0
- data/lib/engine.rb +4 -0
- data/lib/generators/templates/config/initializers/devise.rb +204 -0
- data/lib/generators/templates/config/initializers/touchpass.rb +24 -0
- data/lib/generators/templates/config/locales/devise.en.yml +53 -0
- data/lib/generators/touchpass/install_generator.rb +36 -0
- data/lib/touchpass/client.rb +431 -0
- data/lib/touchpass/crypt.rb +51 -0
- data/lib/touchpass/device.rb +18 -0
- data/lib/touchpass/key_file_creator.rb +56 -0
- data/lib/touchpass/prp.rb +256 -0
- data/lib/touchpass/verification.rb +112 -0
- data/lib/touchpass/version.rb +3 -0
- data/lib/touchpass.rb +53 -0
- data/spec/bounding_box_spec.rb +26 -0
- data/spec/geocode_spec.rb +22 -0
- data/spec/helpers/client_spec_helper.rb +1 -0
- data/spec/helpers/gtp_spec_helper.rb +98 -0
- data/spec/key_file_creator_spec.rb +30 -0
- data/spec/proximity_spec.rb +283 -0
- data/spec/prp_spec.rb +86 -0
- data/spec/resolution_spec.rb +46 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/touchpass_client_spec.rb +319 -0
- data/touchpass.gemspec +27 -0
- metadata +146 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'httparty', '~> 0.8.0'
|
4
|
+
gem 'thor', '~> 0.14.6'
|
5
|
+
gem 'geocoder', '~> 1.1.0'
|
6
|
+
gem 'json', '~> 1.6.5'
|
7
|
+
gem 'xml-simple', '~> 1.1.1'
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem 'guard'
|
11
|
+
gem 'growl'
|
12
|
+
gem 'guard-rspec'
|
13
|
+
gem 'rspec-core'
|
14
|
+
gem 'rspec-mocks'
|
15
|
+
gem 'rspec-expectations'
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
ffi (1.0.11)
|
6
|
+
geocoder (1.1.1)
|
7
|
+
growl (1.0.3)
|
8
|
+
guard (1.0.0)
|
9
|
+
ffi (>= 0.5.0)
|
10
|
+
thor (~> 0.14.6)
|
11
|
+
guard-rspec (0.6.0)
|
12
|
+
guard (>= 0.10.0)
|
13
|
+
httparty (0.8.1)
|
14
|
+
multi_json
|
15
|
+
multi_xml
|
16
|
+
json (1.6.5)
|
17
|
+
multi_json (1.1.0)
|
18
|
+
multi_xml (0.4.1)
|
19
|
+
rspec-core (2.8.0)
|
20
|
+
rspec-expectations (2.8.0)
|
21
|
+
diff-lcs (~> 1.1.2)
|
22
|
+
rspec-mocks (2.8.0)
|
23
|
+
thor (0.14.6)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
geocoder (~> 1.1.0)
|
30
|
+
growl
|
31
|
+
guard
|
32
|
+
guard-rspec
|
33
|
+
httparty (~> 0.8.0)
|
34
|
+
json
|
35
|
+
rspec-core
|
36
|
+
rspec-expectations
|
37
|
+
rspec-mocks
|
38
|
+
thor (~> 0.14.6)
|
data/Guardfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Touchpass
|
2
|
+
class VerificationsController < ApplicationController
|
3
|
+
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
def create
|
7
|
+
verification = Touchpass::Rp::Verification.new
|
8
|
+
response = verification.create params[:to_user], {:address => params[:address], :message => params[:message]}
|
9
|
+
respond_to do |format|
|
10
|
+
format.js { render :json => response.to_json }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
verification = Touchpass::Rp::Verification.new
|
16
|
+
response = verification.show params[:id]
|
17
|
+
respond_to do |format|
|
18
|
+
format.js { render :json => response.to_json }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def cancel
|
23
|
+
verification = Touchpass::Rp::Verification.new
|
24
|
+
response = verification.cancel params[:id]
|
25
|
+
respond_to do |format|
|
26
|
+
format.js { render :json => response.to_json }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/bin/tpcli.rb
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Geodica Touchpass
|
4
|
+
# (C) Copyright 2009-2012 Geodica, a Carpadium Pty Ltd Venture
|
5
|
+
# All rights reserved
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'thor'
|
9
|
+
require 'httparty'
|
10
|
+
require 'openssl'
|
11
|
+
require 'fileutils'
|
12
|
+
require 'base64'
|
13
|
+
require 'xmlsimple'
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
|
16
|
+
require "touchpass"
|
17
|
+
|
18
|
+
class TpCLI < Thor
|
19
|
+
|
20
|
+
DFT_API_KEY = ENV["TPC_API_KEY"]
|
21
|
+
DFT_HOST = ENV["TPC_HOST"]
|
22
|
+
DFT_DEBUG = ENV["TPC_DEBUG"]
|
23
|
+
DFT_OUTPUT = "json"
|
24
|
+
|
25
|
+
attr_accessor :touchpass_client
|
26
|
+
|
27
|
+
desc "register_party", "Register new Verifying Party"
|
28
|
+
method_option :email, :aliases => "-e", :required => true
|
29
|
+
method_option :username, :aliases => "-u", :required => true
|
30
|
+
method_option :password, :aliases => "-p", :required => true
|
31
|
+
method_option :hostname, :aliases => "-h"
|
32
|
+
method_option :output, :aliases => "-o"
|
33
|
+
method_option :debug, :aliases => "-d"
|
34
|
+
def register_party
|
35
|
+
setup(options)
|
36
|
+
output @touchpass_client.register_party(options)
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "authenticate_party", "Authenticate Party"
|
40
|
+
method_option :login, :aliases => "-l", :required => true
|
41
|
+
method_option :password, :aliases => "-p", :required => true
|
42
|
+
method_option :hostname, :aliases => "-h"
|
43
|
+
method_option :output, :aliases => "-o"
|
44
|
+
method_option :debug, :aliases => "-d"
|
45
|
+
def authenticate_party
|
46
|
+
setup(options)
|
47
|
+
output @touchpass_client.authenticate_party(options)
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "show_party", "Show Party details"
|
51
|
+
method_option :username, :aliases => "-u"
|
52
|
+
method_option :id
|
53
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
54
|
+
method_option :hostname, :aliases => "-h"
|
55
|
+
method_option :output, :aliases => "-o"
|
56
|
+
method_option :debug, :aliases => "-d"
|
57
|
+
def show_party
|
58
|
+
setup(options)
|
59
|
+
output @touchpass_client.get_party(options)
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "update_party", "Update Party details"
|
63
|
+
method_option :username, :aliases => "-u"
|
64
|
+
method_option :id
|
65
|
+
method_option :email, :aliases => "-e"
|
66
|
+
method_option :first_name
|
67
|
+
method_option :last_name
|
68
|
+
method_option :api_key, :required => true
|
69
|
+
method_option :hostname, :aliases => "-h"
|
70
|
+
method_option :output, :aliases => "-o"
|
71
|
+
method_option :debug, :aliases => "-d"
|
72
|
+
def update_party
|
73
|
+
setup(options)
|
74
|
+
output @touchpass_client.update_party(options)
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "register_device", "Register new Device"
|
78
|
+
method_option :username, :aliases => "-u", :required => true
|
79
|
+
method_option :udid, :required => true
|
80
|
+
method_option :name, :aliases => "-n", :required => true
|
81
|
+
method_option :messaging_type, :aliases => "-mt"
|
82
|
+
method_option :messaging_value, :aliases => "-mv"
|
83
|
+
method_option :api_key, :required => true
|
84
|
+
method_option :hostname, :aliases => "-h"
|
85
|
+
method_option :output, :aliases => "-o"
|
86
|
+
method_option :debug, :aliases => "-d"
|
87
|
+
def register_device
|
88
|
+
setup(options)
|
89
|
+
output @touchpass_client.register_device(options)
|
90
|
+
end
|
91
|
+
|
92
|
+
desc "show_devices", "Show Party Devices"
|
93
|
+
method_option :username, :aliases => "-u", :required => true
|
94
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
95
|
+
method_option :hostname, :aliases => "-h"
|
96
|
+
method_option :output, :aliases => "-o"
|
97
|
+
method_option :debug, :aliases => "-d"
|
98
|
+
def show_devices
|
99
|
+
setup(options)
|
100
|
+
output @touchpass_client.get_devices(options)
|
101
|
+
end
|
102
|
+
|
103
|
+
desc "show_device", "Show Device details"
|
104
|
+
method_option :username, :aliases => "-u", :required => true
|
105
|
+
method_option :id, :required => true
|
106
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
107
|
+
method_option :hostname, :aliases => "-h"
|
108
|
+
method_option :output, :aliases => "-o"
|
109
|
+
method_option :debug, :aliases => "-d"
|
110
|
+
def show_device
|
111
|
+
setup(options)
|
112
|
+
output @touchpass_client.get_device(options)
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "update_device", "Update Device details"
|
116
|
+
method_option :username, :aliases => "-u", :required => true
|
117
|
+
method_option :id, :required => true
|
118
|
+
method_option :name, :aliases => "-n"
|
119
|
+
method_option :messaging_type, :aliases => "-mt"
|
120
|
+
method_option :messaging_value, :aliases => "-mv"
|
121
|
+
method_option :update_pub_key
|
122
|
+
method_option :api_key, :required => true
|
123
|
+
method_option :hostname, :aliases => "-h"
|
124
|
+
method_option :output, :aliases => "-o"
|
125
|
+
method_option :debug, :aliases => "-d"
|
126
|
+
def update_device
|
127
|
+
setup(options)
|
128
|
+
output @touchpass_client.update_device(options)
|
129
|
+
end
|
130
|
+
|
131
|
+
desc "remove_device", "Remove Device"
|
132
|
+
method_option :username, :aliases => "-u", :required => true
|
133
|
+
method_option :id, :required => true
|
134
|
+
method_option :api_key, :required => true
|
135
|
+
method_option :hostname, :aliases => "-h"
|
136
|
+
method_option :output, :aliases => "-o"
|
137
|
+
method_option :debug, :aliases => "-d"
|
138
|
+
def remove_device
|
139
|
+
setup(options)
|
140
|
+
output @touchpass_client.remove_device(options)
|
141
|
+
end
|
142
|
+
|
143
|
+
desc "create_verification", "Create new Verification"
|
144
|
+
method_option :to_party, :aliases => "-t", :required => true
|
145
|
+
method_option :to_device_id, :aliases => "-D"
|
146
|
+
method_option :message, :aliases => "-m"
|
147
|
+
method_option :address, :aliases => "-a" # Required for location verfication
|
148
|
+
method_option :resolution, :aliases => "-r"
|
149
|
+
method_option :api_key, :required => true
|
150
|
+
method_option :hostname, :aliases => "-h"
|
151
|
+
method_option :output, :aliases => "-o"
|
152
|
+
method_option :debug, :aliases => "-d"
|
153
|
+
def create_verification
|
154
|
+
setup(options)
|
155
|
+
output @touchpass_client.create_verification(options)
|
156
|
+
end
|
157
|
+
|
158
|
+
desc "show_verifications", "Show Verifications"
|
159
|
+
method_option :username, :aliases => "-u"
|
160
|
+
method_option :party_id
|
161
|
+
method_option :api_key, :required => true
|
162
|
+
method_option :hostname, :aliases => "-h"
|
163
|
+
method_option :output, :aliases => "-o"
|
164
|
+
method_option :debug, :aliases => "-d"
|
165
|
+
def show_verifications
|
166
|
+
setup(options)
|
167
|
+
output @touchpass_client.get_verifications(options)
|
168
|
+
end
|
169
|
+
|
170
|
+
desc "show_verification", "Show Verification details"
|
171
|
+
method_option :id, :aliases => "-i", :required => true
|
172
|
+
method_option :device_id # For decrypting message (optional)
|
173
|
+
method_option :api_key, :required => true
|
174
|
+
method_option :hostname, :aliases => "-h"
|
175
|
+
method_option :output, :aliases => "-o"
|
176
|
+
method_option :debug, :aliases => "-d"
|
177
|
+
def show_verification
|
178
|
+
setup(options)
|
179
|
+
output @touchpass_client.get_verification(options)
|
180
|
+
end
|
181
|
+
|
182
|
+
desc "update_verification", "Update Verification"
|
183
|
+
method_option :id, :required => true
|
184
|
+
method_option :device_id, :required => true, :aliases => "-d"
|
185
|
+
method_option :address, :aliases => "-a"
|
186
|
+
method_option :api_key, :required => true
|
187
|
+
method_option :hostname, :aliases => "-h"
|
188
|
+
method_option :output, :aliases => "-o"
|
189
|
+
method_option :debug, :aliases => "-d"
|
190
|
+
def update_verification
|
191
|
+
setup(options)
|
192
|
+
output @touchpass_client.update_verification(options)
|
193
|
+
end
|
194
|
+
|
195
|
+
desc "cancel_verification", "Cancel Verification"
|
196
|
+
method_option :id, :required => true
|
197
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
198
|
+
method_option :hostname, :aliases => "-h"
|
199
|
+
method_option :output, :aliases => "-o"
|
200
|
+
method_option :debug, :aliases => "-d"
|
201
|
+
def cancel_verification
|
202
|
+
setup(options)
|
203
|
+
output @touchpass_client.cancel_verification(options)
|
204
|
+
end
|
205
|
+
|
206
|
+
desc "reject_verification", "Reject Verification"
|
207
|
+
method_option :id, :required => true
|
208
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
209
|
+
method_option :hostname, :aliases => "-h"
|
210
|
+
method_option :output, :aliases => "-o"
|
211
|
+
method_option :debug, :aliases => "-d"
|
212
|
+
def reject_verification
|
213
|
+
setup(options)
|
214
|
+
output @touchpass_client.reject_verification(options)
|
215
|
+
end
|
216
|
+
|
217
|
+
private
|
218
|
+
|
219
|
+
# Construct a Touchpass:Client instance
|
220
|
+
def setup(options)
|
221
|
+
@output = (options[:output] || DFT_OUTPUT).to_sym
|
222
|
+
unless [:xml, :json].include?(@output)
|
223
|
+
puts "error: output format '#{@output}' is not supported, use xml or json"
|
224
|
+
exit 1
|
225
|
+
end
|
226
|
+
|
227
|
+
hostname = options[:hostname] || DFT_HOST
|
228
|
+
debug = options[:debug] || DFT_DEBUG
|
229
|
+
api_key = options[:api_key] || DFT_API_KEY
|
230
|
+
|
231
|
+
@touchpass_client = Touchpass::Client.new(hostname, debug)
|
232
|
+
@touchpass_client.api_key = api_key
|
233
|
+
@touchpass_client
|
234
|
+
end
|
235
|
+
|
236
|
+
def output(response)
|
237
|
+
case @output
|
238
|
+
when :xml
|
239
|
+
puts XmlSimple.xml_out(response, 'NoAttr' => true, 'RootName' => 'response')
|
240
|
+
when :json
|
241
|
+
puts JSON.pretty_generate(response)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
# Kick off the Touchpass CLI
|
248
|
+
TpCLI.start
|
data/config/routes.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#config/routes.rb
|
2
|
+
Rails.application.routes.draw do |map|
|
3
|
+
scope :module => 'touchpass' do
|
4
|
+
get "touchpass/verifications/:id" => 'verifications#show'
|
5
|
+
post "touchpass/verifications" => 'verifications#create'
|
6
|
+
put "touchpass/verifications/:id/cancel" => 'verifications#cancel'
|
7
|
+
end
|
8
|
+
end
|
data/lib/engine.rb
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
2
|
+
# four configuration values can also be set straight in your models.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
5
|
+
# Configure the e-mail address which will be shown in DeviseMailer.
|
6
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
7
|
+
|
8
|
+
# Configure the class responsible to send e-mails.
|
9
|
+
# config.mailer = "Devise::Mailer"
|
10
|
+
|
11
|
+
# ==> ORM configuration
|
12
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
13
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
14
|
+
# available as additional gems.
|
15
|
+
require 'devise/orm/active_record'
|
16
|
+
|
17
|
+
# ==> Configuration for any authentication mechanism
|
18
|
+
# Configure which keys are used when authenticating a user. The default is
|
19
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
20
|
+
# authenticating a user, both parameters are required. Remember that those
|
21
|
+
# parameters are used only when authenticating and not when retrieving from
|
22
|
+
# session. If you need permissions, you should implement that in a before filter.
|
23
|
+
# You can also supply a hash where the value is a boolean determining whether
|
24
|
+
# or not authentication should be aborted when the value is not present.
|
25
|
+
config.authentication_keys = [ :login ]
|
26
|
+
|
27
|
+
# Configure parameters from the request object used for authentication. Each entry
|
28
|
+
# given should be a request method and it will automatically be passed to the
|
29
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
30
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
31
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
32
|
+
# config.request_keys = []
|
33
|
+
|
34
|
+
# Configure which authentication keys should be case-insensitive.
|
35
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
36
|
+
# to authenticate or find a user. Default is :email.
|
37
|
+
config.case_insensitive_keys = [ :email ]
|
38
|
+
|
39
|
+
# Configure which authentication keys should have whitespace stripped.
|
40
|
+
# These keys will have whitespace before and after removed upon creating or
|
41
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
42
|
+
config.strip_whitespace_keys = [ :email ]
|
43
|
+
|
44
|
+
# Tell if authentication through request.params is enabled. True by default.
|
45
|
+
# config.params_authenticatable = true
|
46
|
+
|
47
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
48
|
+
# config.http_authenticatable = false
|
49
|
+
|
50
|
+
# If http headers should be returned for AJAX requests. True by default.
|
51
|
+
# config.http_authenticatable_on_xhr = true
|
52
|
+
|
53
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
54
|
+
# config.http_authentication_realm = "Application"
|
55
|
+
|
56
|
+
# It will change confirmation, password recovery and other workflows
|
57
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
58
|
+
# Does not affect registerable.
|
59
|
+
# config.paranoid = true
|
60
|
+
|
61
|
+
# ==> Configuration for :database_authenticatable
|
62
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
63
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
64
|
+
config.stretches = 10
|
65
|
+
|
66
|
+
# Setup a pepper to generate the encrypted password.
|
67
|
+
# config.pepper = "c4d6f4a2a9f3f649d369ccf29bfd125a8b897383bf858c3069f3e9b248f3295ff79fa43241e7caa07db43e004d5f078af7e4853539e02cb104b3a0965b95923a"
|
68
|
+
|
69
|
+
# ==> Configuration for :confirmable
|
70
|
+
# The time you want to give your user to confirm his account. During this time
|
71
|
+
# he will be able to access your application without confirming. Default is 0.days
|
72
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
73
|
+
# You can use this to let your user access some features of your application
|
74
|
+
# without confirming the account, but blocking it after a certain period
|
75
|
+
# (ie 2 days).
|
76
|
+
# config.confirm_within = 2.days
|
77
|
+
|
78
|
+
# Defines which key will be used when confirming an account
|
79
|
+
# config.confirmation_keys = [ :email ]
|
80
|
+
|
81
|
+
# ==> Configuration for :rememberable
|
82
|
+
# The time the user will be remembered without asking for credentials again.
|
83
|
+
# config.remember_for = 2.weeks
|
84
|
+
|
85
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
86
|
+
# config.remember_across_browsers = true
|
87
|
+
|
88
|
+
# If true, extends the user's remember period when remembered via cookie.
|
89
|
+
# config.extend_remember_period = false
|
90
|
+
|
91
|
+
# If true, uses the password salt as remember token. This should be turned
|
92
|
+
# to false if you are not using database authenticatable.
|
93
|
+
config.use_salt_as_remember_token = true
|
94
|
+
|
95
|
+
# Options to be passed to the created cookie. For instance, you can set
|
96
|
+
# :secure => true in order to force SSL only cookies.
|
97
|
+
# config.cookie_options = {}
|
98
|
+
|
99
|
+
# ==> Configuration for :validatable
|
100
|
+
# Range for password length. Default is 6..128.
|
101
|
+
# config.password_length = 6..128
|
102
|
+
|
103
|
+
# Regex to use to validate the email address
|
104
|
+
# config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
|
105
|
+
|
106
|
+
# ==> Configuration for :timeoutable
|
107
|
+
# The time you want to timeout the user session without activity. After this
|
108
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
109
|
+
# config.timeout_in = 30.minutes
|
110
|
+
|
111
|
+
# ==> Configuration for :lockable
|
112
|
+
# Defines which strategy will be used to lock an account.
|
113
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
114
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
115
|
+
# config.lock_strategy = :failed_attempts
|
116
|
+
|
117
|
+
# Defines which key will be used when locking and unlocking an account
|
118
|
+
# config.unlock_keys = [ :email ]
|
119
|
+
|
120
|
+
# Defines which strategy will be used to unlock an account.
|
121
|
+
# :email = Sends an unlock link to the user email
|
122
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
123
|
+
# :both = Enables both strategies
|
124
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
125
|
+
# config.unlock_strategy = :both
|
126
|
+
|
127
|
+
# Number of authentication tries before locking an account if lock_strategy
|
128
|
+
# is failed attempts.
|
129
|
+
# config.maximum_attempts = 20
|
130
|
+
|
131
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
132
|
+
# config.unlock_in = 1.hour
|
133
|
+
|
134
|
+
# ==> Configuration for :recoverable
|
135
|
+
#
|
136
|
+
# Defines which key will be used when recovering the password for an account
|
137
|
+
# config.reset_password_keys = [ :email ]
|
138
|
+
|
139
|
+
# Time interval you can reset your password with a reset password key.
|
140
|
+
# Don't put a too small interval or your users won't have the time to
|
141
|
+
# change their passwords.
|
142
|
+
config.reset_password_within = 2.hours
|
143
|
+
|
144
|
+
# ==> Configuration for :encryptable
|
145
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
146
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
147
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
148
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
149
|
+
# REST_AUTH_SITE_KEY to pepper)
|
150
|
+
# config.encryptor = :sha512
|
151
|
+
|
152
|
+
# ==> Configuration for :token_authenticatable
|
153
|
+
# Defines name of the authentication token params key
|
154
|
+
config.token_authentication_key = :api_key
|
155
|
+
|
156
|
+
# If true, authentication through token does not store user in session and needs
|
157
|
+
# to be supplied on each request. Useful if you are using the token as API token.
|
158
|
+
# config.stateless_token = false
|
159
|
+
|
160
|
+
# ==> Scopes configuration
|
161
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
162
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
163
|
+
# are using only default views.
|
164
|
+
# config.scoped_views = false
|
165
|
+
|
166
|
+
# Configure the default scope given to Warden. By default it's the first
|
167
|
+
# devise role declared in your routes (usually :user).
|
168
|
+
# config.default_scope = :user
|
169
|
+
|
170
|
+
# Configure sign_out behavior.
|
171
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
172
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
173
|
+
# config.sign_out_all_scopes = true
|
174
|
+
|
175
|
+
# ==> Navigation configuration
|
176
|
+
# Lists the formats that should be treated as navigational. Formats like
|
177
|
+
# :html, should redirect to the sign in page when the user does not have
|
178
|
+
# access, but formats like :xml or :json, should return 401.
|
179
|
+
#
|
180
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
181
|
+
# should add them to the navigational formats lists.
|
182
|
+
#
|
183
|
+
# The :"*/*" and "*/*" formats below is required to match Internet
|
184
|
+
# Explorer requests.
|
185
|
+
# config.navigational_formats = [:"*/*", "*/*", :html]
|
186
|
+
|
187
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
188
|
+
config.sign_out_via = :delete
|
189
|
+
|
190
|
+
# ==> OmniAuth
|
191
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
192
|
+
# up on your models and hooks.
|
193
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
194
|
+
|
195
|
+
# ==> Warden configuration
|
196
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
197
|
+
# change the failure app, you can configure them inside the config.warden block.
|
198
|
+
#
|
199
|
+
# config.warden do |manager|
|
200
|
+
# manager.failure_app = AnotherApp
|
201
|
+
# manager.intercept_401 = false
|
202
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
203
|
+
# end
|
204
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Use this hook to configure Touchpass.
|
2
|
+
Touchpass.setup do |config|
|
3
|
+
# Touchpass Username.
|
4
|
+
config.username = "YOUR_TOUCHPASS_USERNAME"
|
5
|
+
|
6
|
+
# Touchpass API Key.
|
7
|
+
config.api_key = "YOUR_TOUCHPASS_API_KEY"
|
8
|
+
|
9
|
+
# Touchpass Host.
|
10
|
+
config.host = Rails.env == 'production' ? "touchpass.geodica.com" : "localhost"
|
11
|
+
|
12
|
+
# Touchpass Port.
|
13
|
+
config.port = Rails.env == 'production' ? "443" : "3000"
|
14
|
+
|
15
|
+
# Turn https on.
|
16
|
+
config.use_https = true
|
17
|
+
|
18
|
+
# Turn Location Verification on.
|
19
|
+
#config.location_verification = true
|
20
|
+
|
21
|
+
# Defines which resolution will be used when creating Location Verification.
|
22
|
+
# STREET, LOCAL, METRO or REGIONAL
|
23
|
+
#config.resolution = "LOCAL"
|
24
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
errors:
|
5
|
+
messages:
|
6
|
+
expired: "has expired, please request a new one"
|
7
|
+
not_found: "not found"
|
8
|
+
already_confirmed: "was already confirmed, please try signing in"
|
9
|
+
not_locked: "was not locked"
|
10
|
+
not_saved:
|
11
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
12
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
13
|
+
|
14
|
+
devise:
|
15
|
+
failure:
|
16
|
+
already_authenticated: 'You are already signed in.'
|
17
|
+
unauthenticated: 'You need to sign in or sign up before continuing.'
|
18
|
+
unconfirmed: 'You have to confirm your account before continuing.'
|
19
|
+
locked: 'Your account is locked.'
|
20
|
+
invalid: 'Invalid email or password.'
|
21
|
+
invalid_token: 'Invalid authentication token.'
|
22
|
+
timeout: 'Your session expired, please sign in again to continue.'
|
23
|
+
inactive: 'Your account was not activated yet.'
|
24
|
+
sessions:
|
25
|
+
signed_in: 'Signed in successfully.'
|
26
|
+
signed_out: 'Signed out successfully.'
|
27
|
+
passwords:
|
28
|
+
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
29
|
+
updated: 'Your password was changed successfully. You are now signed in.'
|
30
|
+
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
|
31
|
+
confirmations:
|
32
|
+
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
33
|
+
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
|
34
|
+
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
35
|
+
registrations:
|
36
|
+
signed_up: 'Welcome! You have signed up successfully.'
|
37
|
+
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
|
38
|
+
updated: 'You updated your account successfully.'
|
39
|
+
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
40
|
+
unlocks:
|
41
|
+
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
42
|
+
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
43
|
+
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
|
44
|
+
omniauth_callbacks:
|
45
|
+
success: 'Successfully authorized from %{kind} account.'
|
46
|
+
failure: 'Could not authorize you from %{kind} because "%{reason}".'
|
47
|
+
mailer:
|
48
|
+
confirmation_instructions:
|
49
|
+
subject: 'Confirmation instructions'
|
50
|
+
reset_password_instructions:
|
51
|
+
subject: 'Reset password instructions'
|
52
|
+
unlock_instructions:
|
53
|
+
subject: 'Unlock Instructions'
|