phcdevworks_accounts_devise 0.1.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +11 -0
- data/Rakefile +8 -0
- data/app/assets/config/phcdevworks_accounts_devise_manifest.js +2 -0
- data/app/controllers/phcdevworks_accounts_devise/admin/pages_controller.rb +25 -0
- data/app/controllers/phcdevworks_accounts_devise/application_controller.rb +25 -0
- data/app/controllers/phcdevworks_accounts_devise/user/pages_controller.rb +15 -0
- data/app/controllers/users/confirmations_controller.rb +30 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +30 -0
- data/app/controllers/users/passwords_controller.rb +34 -0
- data/app/controllers/users/registrations_controller.rb +74 -0
- data/app/controllers/users/sessions_controller.rb +27 -0
- data/app/controllers/users/unlocks_controller.rb +30 -0
- data/app/helpers/phcdevworks_accounts_devise/admin/pages_helper.rb +4 -0
- data/app/helpers/phcdevworks_accounts_devise/application_helper.rb +4 -0
- data/app/helpers/phcdevworks_accounts_devise/user/pages_helper.rb +4 -0
- data/app/jobs/phcdevworks_accounts_devise/application_job.rb +4 -0
- data/app/mailers/phcdevworks_accounts_devise/application_mailer.rb +6 -0
- data/app/models/phcdevworks_accounts_devise/application_record.rb +5 -0
- data/app/models/phcdevworks_accounts_devise/user.rb +39 -0
- data/app/views/layouts/phcdevworks_accounts_devise/application.html.erb +73 -0
- data/app/views/layouts/phcdevworks_accounts_devise/application_full_width.html.erb +73 -0
- data/app/views/layouts/phcdevworks_accounts_devise/application_no_sidebar.html.erb +64 -0
- data/app/views/layouts/phcdevworks_accounts_devise/application_profile.html.erb +73 -0
- data/app/views/layouts/phcdevworks_accounts_devise/components/backend/footer/_footer.html.erb +17 -0
- data/app/views/layouts/phcdevworks_accounts_devise/components/backend/navigation/_top_menu.html.erb +41 -0
- data/app/views/layouts/phcdevworks_accounts_devise/components/backend/sidebars/_side_menu.html.erb +529 -0
- data/app/views/layouts/phcdevworks_accounts_devise/devise.html.erb +38 -0
- data/app/views/phcdevworks_accounts_devise/admin/pages/components/_profile_header.html.erb +27 -0
- data/app/views/phcdevworks_accounts_devise/admin/pages/dashboard.html.erb +0 -0
- data/app/views/phcdevworks_accounts_devise/admin/pages/user_profile.html.erb +22 -0
- data/app/views/phcdevworks_accounts_devise/admin/pages/users_list.html.erb +68 -0
- data/app/views/phcdevworks_accounts_devise/user/pages/dashboard.html.erb +0 -0
- data/app/views/phcdevworks_accounts_devise/user/pages/profile.html.erb +0 -0
- data/app/views/users/confirmations/new.html.erb +48 -0
- data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/users/mailer/email_changed.html.erb +7 -0
- data/app/views/users/mailer/password_change.html.erb +3 -0
- data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/users/passwords/edit.html.erb +59 -0
- data/app/views/users/passwords/new.html.erb +51 -0
- data/app/views/users/registrations/edit.html.erb +100 -0
- data/app/views/users/registrations/new.html.erb +109 -0
- data/app/views/users/sessions/new.html.erb +92 -0
- data/app/views/users/shared/_links.html.erb +25 -0
- data/app/views/users/unlocks/new.html.erb +50 -0
- data/config/initializers/devise.rb +310 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/routes.rb +19 -0
- data/config/spring.rb +2 -0
- data/db/migrate/20191012042035_devise_create_phcdevworks_accounts_devise_users.rb +46 -0
- data/db/migrate/20191012060241_add_userinfo_to_users.rb +15 -0
- data/db/migrate/20191012060308_add_role_to_users.rb +7 -0
- data/db/migrate/20191012060324_add_tos_to_users.rb +7 -0
- data/db/migrate/20210407121952_add_customer_id_to_users.rb +7 -0
- data/db/migrate/20210425060053_add_subscription_id_to_users.rb +7 -0
- data/lib/phcdevworks_accounts_devise/engine.rb +43 -0
- data/lib/phcdevworks_accounts_devise/version.rb +3 -0
- data/lib/phcdevworks_accounts_devise.rb +6 -0
- data/lib/tasks/phcdevworks_accounts_devise_tasks.rake +4 -0
- metadata +417 -0
@@ -0,0 +1,310 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
+
# Many of these configuration options can be set straight in your model.
|
5
|
+
Devise.setup do |config|
|
6
|
+
|
7
|
+
# The secret key used by Devise. Devise uses this key to generate
|
8
|
+
# random tokens. Changing this key will render invalid all existing
|
9
|
+
# confirmation, reset password and unlock tokens in the database.
|
10
|
+
# Devise will use the `secret_key_base` as its `secret_key`
|
11
|
+
# by default. You can change it below and use your own secret key.
|
12
|
+
config.secret_key = ENV['SECRET_KEY_BASE'] if Rails.env.production?
|
13
|
+
|
14
|
+
# ==> Controller configuration
|
15
|
+
# Configure the parent class to the devise controllers.
|
16
|
+
config.parent_controller = 'PhcdevworksAccountsDevise::ApplicationController'
|
17
|
+
|
18
|
+
# ==> Mailer Configuration
|
19
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
20
|
+
# note that it will be overwritten if you use your own mailer class
|
21
|
+
# with default "from" parameter.
|
22
|
+
config.mailer_sender = ENV['PHCDEV_EMAIL_SENDER']
|
23
|
+
|
24
|
+
# Configure the class responsible to send e-mails.
|
25
|
+
# config.mailer = 'Devise::Mailer'
|
26
|
+
|
27
|
+
# Configure the parent class responsible to send e-mails.
|
28
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
29
|
+
|
30
|
+
# ==> ORM configuration
|
31
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
32
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
33
|
+
# available as additional gems.
|
34
|
+
require 'devise/orm/active_record'
|
35
|
+
|
36
|
+
# ==> Configuration for any authentication mechanism
|
37
|
+
# Configure which keys are used when authenticating a user. The default is
|
38
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
39
|
+
# authenticating a user, both parameters are required. Remember that those
|
40
|
+
# parameters are used only when authenticating and not when retrieving from
|
41
|
+
# session. If you need permissions, you should implement that in a before filter.
|
42
|
+
# You can also supply a hash where the value is a boolean determining whether
|
43
|
+
# or not authentication should be aborted when the value is not present.
|
44
|
+
# config.authentication_keys = [:email]
|
45
|
+
|
46
|
+
# Configure parameters from the request object used for authentication. Each entry
|
47
|
+
# given should be a request method and it will automatically be passed to the
|
48
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
49
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
50
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
51
|
+
# config.request_keys = []
|
52
|
+
|
53
|
+
# Configure which authentication keys should be case-insensitive.
|
54
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
55
|
+
# to authenticate or find a user. Default is :email.
|
56
|
+
config.case_insensitive_keys = [:email]
|
57
|
+
|
58
|
+
# Configure which authentication keys should have whitespace stripped.
|
59
|
+
# These keys will have whitespace before and after removed upon creating or
|
60
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
61
|
+
config.strip_whitespace_keys = [:email]
|
62
|
+
|
63
|
+
# Tell if authentication through request.params is enabled. True by default.
|
64
|
+
# It can be set to an array that will enable params authentication only for the
|
65
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
66
|
+
# enable it only for database (email + password) authentication.
|
67
|
+
# config.params_authenticatable = true
|
68
|
+
|
69
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
70
|
+
# It can be set to an array that will enable http authentication only for the
|
71
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
72
|
+
# enable it only for database authentication. The supported strategies are:
|
73
|
+
# :database = Support basic authentication with authentication key + password
|
74
|
+
# config.http_authenticatable = false
|
75
|
+
|
76
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
77
|
+
# config.http_authenticatable_on_xhr = true
|
78
|
+
|
79
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
80
|
+
# config.http_authentication_realm = 'Application'
|
81
|
+
|
82
|
+
# It will change confirmation, password recovery and other workflows
|
83
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
84
|
+
# Does not affect registerable.
|
85
|
+
# config.paranoid = true
|
86
|
+
|
87
|
+
# By default Devise will store the user in session. You can skip storage for
|
88
|
+
# particular strategies by setting this option.
|
89
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
90
|
+
# may want to disable generating routes to Devise's sessions controller by
|
91
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
92
|
+
config.skip_session_storage = [:http_auth]
|
93
|
+
|
94
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
95
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
96
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
97
|
+
# from the server. You can disable this option at your own risk.
|
98
|
+
# config.clean_up_csrf_token_on_authentication = true
|
99
|
+
|
100
|
+
# When false, Devise will not attempt to reload routes on eager load.
|
101
|
+
# This can reduce the time taken to boot the app but if your application
|
102
|
+
# requires the Devise mappings to be loaded during boot time the application
|
103
|
+
# won't boot properly.
|
104
|
+
# config.reload_routes = true
|
105
|
+
|
106
|
+
# ==> Configuration for :database_authenticatable
|
107
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
108
|
+
# using other algorithms, it sets how many times you want the password to be hashed.
|
109
|
+
#
|
110
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
111
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
112
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
113
|
+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
114
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
115
|
+
config.stretches = Rails.env.test? ? 1 : 11
|
116
|
+
|
117
|
+
# Set up a pepper to generate the hashed password.
|
118
|
+
# config.pepper = '8cb8115e84ce11219f028bd27b1a98ab5802a37cd0ab7e54b92ba74e64370b4a415602cc933e7215128faa952c4a7c5ff813d9ff83a3f8bea5d01c23c1f70f64'
|
119
|
+
|
120
|
+
# Send a notification to the original email when the user's email is changed.
|
121
|
+
# config.send_email_changed_notification = false
|
122
|
+
|
123
|
+
# Send a notification email when the user's password is changed.
|
124
|
+
# config.send_password_change_notification = false
|
125
|
+
|
126
|
+
# ==> Configuration for :confirmable
|
127
|
+
# A period that the user is allowed to access the website even without
|
128
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
129
|
+
# able to access the website for two days without confirming their account,
|
130
|
+
# access will be blocked just in the third day.
|
131
|
+
# You can also set it to nil, which will allow the user to access the website
|
132
|
+
# without confirming their account.
|
133
|
+
# Default is 0.days, meaning the user cannot access the website without
|
134
|
+
# confirming their account.
|
135
|
+
# config.allow_unconfirmed_access_for = 2.days
|
136
|
+
|
137
|
+
# A period that the user is allowed to confirm their account before their
|
138
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
139
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
140
|
+
# their account can't be confirmed with the token any more.
|
141
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
142
|
+
# before confirming their account.
|
143
|
+
# config.confirm_within = 3.days
|
144
|
+
|
145
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
146
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
147
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
148
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
149
|
+
config.reconfirmable = true
|
150
|
+
|
151
|
+
# Defines which key will be used when confirming an account
|
152
|
+
# config.confirmation_keys = [:email]
|
153
|
+
|
154
|
+
# ==> Configuration for :rememberable
|
155
|
+
# The time the user will be remembered without asking for credentials again.
|
156
|
+
# config.remember_for = 2.weeks
|
157
|
+
|
158
|
+
# Invalidates all the remember me tokens when the user signs out.
|
159
|
+
config.expire_all_remember_me_on_sign_out = true
|
160
|
+
|
161
|
+
# If true, extends the user's remember period when remembered via cookie.
|
162
|
+
# config.extend_remember_period = false
|
163
|
+
|
164
|
+
# Options to be passed to the created cookie. For instance, you can set
|
165
|
+
# secure: true in order to force SSL only cookies.
|
166
|
+
# config.rememberable_options = {}
|
167
|
+
|
168
|
+
# ==> Configuration for :validatable
|
169
|
+
# Range for password length.
|
170
|
+
config.password_length = 6..128
|
171
|
+
|
172
|
+
# Email regex used to validate email formats. It simply asserts that
|
173
|
+
# one (and only one) @ exists in the given string. This is mainly
|
174
|
+
# to give user feedback and not to assert the e-mail validity.
|
175
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
176
|
+
|
177
|
+
# ==> Configuration for :timeoutable
|
178
|
+
# The time you want to timeout the user session without activity. After this
|
179
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
180
|
+
# config.timeout_in = 30.minutes
|
181
|
+
|
182
|
+
# ==> Configuration for :lockable
|
183
|
+
# Defines which strategy will be used to lock an account.
|
184
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
185
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
186
|
+
# config.lock_strategy = :failed_attempts
|
187
|
+
|
188
|
+
# Defines which key will be used when locking and unlocking an account
|
189
|
+
# config.unlock_keys = [:email]
|
190
|
+
|
191
|
+
# Defines which strategy will be used to unlock an account.
|
192
|
+
# :email = Sends an unlock link to the user email
|
193
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
194
|
+
# :both = Enables both strategies
|
195
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
196
|
+
# config.unlock_strategy = :both
|
197
|
+
|
198
|
+
# Number of authentication tries before locking an account if lock_strategy
|
199
|
+
# is failed attempts.
|
200
|
+
# config.maximum_attempts = 20
|
201
|
+
|
202
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
203
|
+
# config.unlock_in = 1.hour
|
204
|
+
|
205
|
+
# Warn on the last attempt before the account is locked.
|
206
|
+
# config.last_attempt_warning = true
|
207
|
+
|
208
|
+
# ==> Configuration for :recoverable
|
209
|
+
#
|
210
|
+
# Defines which key will be used when recovering the password for an account
|
211
|
+
# config.reset_password_keys = [:email]
|
212
|
+
|
213
|
+
# Time interval you can reset your password with a reset password key.
|
214
|
+
# Don't put a too small interval or your users won't have the time to
|
215
|
+
# change their passwords.
|
216
|
+
config.reset_password_within = 6.hours
|
217
|
+
|
218
|
+
# When set to false, does not sign a user in automatically after their password is
|
219
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
220
|
+
# config.sign_in_after_reset_password = true
|
221
|
+
|
222
|
+
# ==> Configuration for :encryptable
|
223
|
+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
224
|
+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
225
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
226
|
+
# for default behavior) and :restful_authentication_sha1 (then you should set
|
227
|
+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
228
|
+
#
|
229
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
230
|
+
# config.encryptor = :sha512
|
231
|
+
|
232
|
+
# ==> Scopes configuration
|
233
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
234
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
235
|
+
# are using only default views.
|
236
|
+
config.scoped_views = true
|
237
|
+
|
238
|
+
# Configure the default scope given to Warden. By default it's the first
|
239
|
+
# devise role declared in your routes (usually :user).
|
240
|
+
config.default_scope = :user
|
241
|
+
|
242
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
243
|
+
# only the current scope. By default, Devise signs out all scopes.
|
244
|
+
config.sign_out_all_scopes = true
|
245
|
+
|
246
|
+
# ==> Navigation configuration
|
247
|
+
# Lists the formats that should be treated as navigational. Formats like
|
248
|
+
# :html, should redirect to the sign in page when the user does not have
|
249
|
+
# access, but formats like :xml or :json, should return 401.
|
250
|
+
#
|
251
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
252
|
+
# should add them to the navigational formats lists.
|
253
|
+
#
|
254
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
255
|
+
# config.navigational_formats = ['*/*', :html]
|
256
|
+
|
257
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
258
|
+
config.sign_out_via = :delete
|
259
|
+
|
260
|
+
# ==> OmniAuth
|
261
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
262
|
+
# up on your models and hooks.
|
263
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
264
|
+
|
265
|
+
# ==> Warden configuration
|
266
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
267
|
+
# change the failure app, you can configure them inside the config.warden block.
|
268
|
+
#
|
269
|
+
# config.warden do |manager|
|
270
|
+
# manager.intercept_401 = false
|
271
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
272
|
+
# end
|
273
|
+
|
274
|
+
# ==> Mountable engine configurations
|
275
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
276
|
+
# is mountable, there are some extra configurations to be taken into account.
|
277
|
+
# The following options are available, assuming the engine is mounted as:
|
278
|
+
#
|
279
|
+
# mount MyEngine, at: '/my_engine'
|
280
|
+
#
|
281
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
282
|
+
config.router_name = :phcdevworks_accounts_devise
|
283
|
+
#
|
284
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
285
|
+
# so you need to do it manually. For the users scope, it would be:
|
286
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
287
|
+
|
288
|
+
# ==> Turbolinks configuration
|
289
|
+
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
290
|
+
#
|
291
|
+
# ActiveSupport.on_load(:devise_failure_app) do
|
292
|
+
# include Turbolinks::Controller
|
293
|
+
# end
|
294
|
+
|
295
|
+
# ==> Configuration for :registerable
|
296
|
+
|
297
|
+
# When set to false, does not sign a user in automatically after their password is
|
298
|
+
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
299
|
+
# config.sign_in_after_change_password = true
|
300
|
+
|
301
|
+
# Change Layouts According to Controller
|
302
|
+
Rails.application.config.to_prepare do
|
303
|
+
Devise::SessionsController.layout "phcdevworks_accounts_devise/devise"
|
304
|
+
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "phcdevworks_accounts_devise/application" : "phcdevworks_accounts_devise/devise" }
|
305
|
+
Devise::ConfirmationsController.layout "phcdevworks_accounts_devise/application_no_sidebar"
|
306
|
+
Devise::UnlocksController.layout "phcdevworks_accounts_devise/application_no_sidebar"
|
307
|
+
Devise::PasswordsController.layout "phcdevworks_accounts_devise/application_no_sidebar"
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your email address has been successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid %{authentication_keys} or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock instructions"
|
26
|
+
email_changed:
|
27
|
+
subject: "Email Changed"
|
28
|
+
password_change:
|
29
|
+
subject: "Password Changed"
|
30
|
+
omniauth_callbacks:
|
31
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
32
|
+
success: "Successfully authenticated from %{kind} account."
|
33
|
+
passwords:
|
34
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
35
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
36
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
37
|
+
updated: "Your password has been changed successfully. You are now signed in."
|
38
|
+
updated_not_active: "Your password has been changed successfully."
|
39
|
+
registrations:
|
40
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
41
|
+
signed_up: "Welcome! You have signed up successfully."
|
42
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
43
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
44
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
45
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
46
|
+
updated: "Your account has been updated successfully."
|
47
|
+
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
|
48
|
+
sessions:
|
49
|
+
signed_in: "Signed in successfully."
|
50
|
+
signed_out: "Signed out successfully."
|
51
|
+
already_signed_out: "Signed out successfully."
|
52
|
+
unlocks:
|
53
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
54
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
55
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
56
|
+
errors:
|
57
|
+
messages:
|
58
|
+
already_confirmed: "was already confirmed, please try signing in"
|
59
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
60
|
+
expired: "has expired, please request a new one"
|
61
|
+
not_found: "not found"
|
62
|
+
not_locked: "was not locked"
|
63
|
+
not_saved:
|
64
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
65
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
PhcdevworksAccountsDevise::Engine.routes.draw do
|
2
|
+
|
3
|
+
# User Dashboard
|
4
|
+
match "user", to: "user/pages#dashboard", via: "get"
|
5
|
+
match "user/profile", to: "user/pages#profile", via: "get"
|
6
|
+
|
7
|
+
# Admin Routes
|
8
|
+
match "/admin", to: "admin/pages#dashboard", via: "get"
|
9
|
+
match "/admin/users/all", to: "admin/pages#users_list", via: "get"
|
10
|
+
match "/admin/user/:id", to: "admin/pages#user_profile", via: "get"
|
11
|
+
|
12
|
+
# User Routes
|
13
|
+
devise_for :users, class_name: "PhcdevworksAccountsDevise::User",
|
14
|
+
module: :devise,
|
15
|
+
controllers: {
|
16
|
+
registrations: 'users/registrations'
|
17
|
+
}
|
18
|
+
|
19
|
+
end
|
data/config/spring.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DeviseCreatePhcdevworksAccountsDeviseUsers < ActiveRecord::Migration[7.0]
|
4
|
+
def change
|
5
|
+
create_table :phcdevworks_accounts_devise_users do |t|
|
6
|
+
|
7
|
+
## Database authenticatable
|
8
|
+
t.string :email, null: false, default: ""
|
9
|
+
t.string :encrypted_password, null: false, default: ""
|
10
|
+
|
11
|
+
## Recoverable
|
12
|
+
t.string :reset_password_token
|
13
|
+
t.datetime :reset_password_sent_at
|
14
|
+
|
15
|
+
## Rememberable
|
16
|
+
t.datetime :remember_created_at
|
17
|
+
|
18
|
+
## Trackable
|
19
|
+
t.integer :sign_in_count, default: 0, null: false
|
20
|
+
t.datetime :current_sign_in_at
|
21
|
+
t.datetime :last_sign_in_at
|
22
|
+
t.string :current_sign_in_ip
|
23
|
+
t.string :last_sign_in_ip
|
24
|
+
|
25
|
+
## Confirmable
|
26
|
+
t.string :confirmation_token
|
27
|
+
t.datetime :confirmed_at
|
28
|
+
t.datetime :confirmation_sent_at
|
29
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
+
|
31
|
+
## Lockable
|
32
|
+
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
33
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
+
t.datetime :locked_at
|
35
|
+
|
36
|
+
t.timestamps null: false
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
add_index :phcdevworks_accounts_devise_users, :email, unique: true
|
41
|
+
add_index :phcdevworks_accounts_devise_users, :reset_password_token, unique: true
|
42
|
+
add_index :phcdevworks_accounts_devise_users, :confirmation_token, unique: true
|
43
|
+
add_index :phcdevworks_accounts_devise_users, :unlock_token, unique: true
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddUserinfoToUsers < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
add_column :phcdevworks_accounts_devise_users, :firstname, :string
|
5
|
+
add_column :phcdevworks_accounts_devise_users, :lastname, :string
|
6
|
+
add_column :phcdevworks_accounts_devise_users, :username, :string
|
7
|
+
add_column :phcdevworks_accounts_devise_users, :org_id, :string
|
8
|
+
|
9
|
+
add_index :phcdevworks_accounts_devise_users, :firstname
|
10
|
+
add_index :phcdevworks_accounts_devise_users, :lastname
|
11
|
+
add_index :phcdevworks_accounts_devise_users, :username, unique: true
|
12
|
+
add_index :phcdevworks_accounts_devise_users, :org_id, unique: true
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PhcdevworksAccountsDevise
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
# Load Main Dependencies
|
5
|
+
require "jbuilder"
|
6
|
+
require "paper_trail"
|
7
|
+
require "friendly_id"
|
8
|
+
|
9
|
+
# Load Theme Dependencies
|
10
|
+
require "phcthemes_admin_panel_pack"
|
11
|
+
require "phcthemes_web_theme_pack"
|
12
|
+
|
13
|
+
# Load Helper Dependencies
|
14
|
+
require "phcdevworks_core"
|
15
|
+
require "phcdevworks_active_menus"
|
16
|
+
require "phcdevworks_notifications"
|
17
|
+
require "phcdevworks_titleseo"
|
18
|
+
|
19
|
+
# Load Upload Dependencies
|
20
|
+
require "aws-sdk-s3"
|
21
|
+
require "google-cloud-storage"
|
22
|
+
require "mini_magick"
|
23
|
+
|
24
|
+
# Frontend Dependencies
|
25
|
+
require "wicked"
|
26
|
+
require "friendly_id"
|
27
|
+
|
28
|
+
# Mailer Dependencies
|
29
|
+
require "mail_form"
|
30
|
+
|
31
|
+
# Security & Payment Dependencies
|
32
|
+
require "devise"
|
33
|
+
require "stripe"
|
34
|
+
isolate_namespace PhcdevworksAccountsDevise
|
35
|
+
# Rspec Generators
|
36
|
+
config.generators do |g|
|
37
|
+
g.test_framework :rspec
|
38
|
+
g.fixture_replacement :factory_bot
|
39
|
+
g.factory_bot dir: 'spec/factories'
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|