diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb
index 259dbb0..377009c 100644
--- a/app/controllers/users/passwords_controller.rb
+++ b/app/controllers/users/passwords_controller.rb
@@ -1,34 +1,34 @@
# frozen_string_literal: true
class Users::PasswordsController < Devise::PasswordsController
- # GET /resource/password/new
- # def new
- # super
- # end
+ GET /resource/password/new
+ def new
+ super
+ end
- # POST /resource/password
- # def create
- # super
- # end
+ POST /resource/password
+ def create
+ super
+ end
- # GET /resource/password/edit?reset_password_token=abcdef
- # def edit
- # super
- # end
+ GET /resource/password/edit?reset_password_token=abcdef
+ def edit
+ super
+ end
- # PUT /resource/password
- # def update
- # super
- # end
+ PUT /resource/password
+ def update
+ super
+ end
- # protected
+ protected
- # def after_resetting_password_path_for(resource)
- # super(resource)
- # end
+ def after_resetting_password_path_for(resource)
+ super(resource)
+ end
- # The path used after sending reset password instructions
- # def after_sending_reset_password_instructions_path_for(resource_name)
- # super(resource_name)
- # end
+ The path used after sending reset password instructions
+ def after_sending_reset_password_instructions_path_for(resource_name)
+ super(resource_name)
+ end
end
diff --git a/app/models/recoverable.rb b/app/models/recoverable.rb
new file mode 100644
index 0000000..b0f2f8e
--- /dev/null
+++ b/app/models/recoverable.rb
@@ -0,0 +1,10 @@
+sign_in_after_reset_password
+
+def set_reset_password_token
+ raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)
+
+ self.reset_password_token = enc
+ self.reset_password_sent_at = Time.now.utc
+ save(validate: false)
+ raw
+end
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index cf1ae28..0476704 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -15,6 +15,9 @@
<%= render partial: 'shared/navigation_bar' %>
+
+
<%= notice %>
+
<%= alert %>
<%= yield %>
diff --git a/config/database.yml b/config/database.yml
index b70ea93..11e5592 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -7,10 +7,6 @@
default: &default
adapter: postgresql
encoding: unicode
- username: <%= ENV["POSTGRES_USER"] %>
- password: <%= ENV["POSTGRES_PASS"] %>
- host: localhost
- port: 5432
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
@@ -19,6 +15,10 @@ default: &default
development:
<<: *default
database: survey_express_normal_development
+ username: <%= ENV["POSTGRES_USER"] %>
+ password: <%= ENV["POSTGRES_PASS"] %>
+ host: localhost
+ port: 5432
# Warning: The database defined as "test" will be erased and
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 7a9f6c3..bec7d43 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -32,6 +32,17 @@
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
+
+ config.action_mailer.smtp_settings = {
+ address: "smtp.gmail.com",
+ port: 587,
+ domain: "example.com",
+ authentication: "plain",
+ enable_starttls_auto: true,
+ user_name: ENV["GMAIL_USERNAME"],
+ password: ENV["GMAIL_PASSWORD"]
+ }
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 3657f7a..dbbca59 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -5,6 +5,18 @@
# Code is not reloaded between requests.
config.cache_classes = true
+
+ config.action_mailer.smtp_settings = {
+ address: "smtp.gmail.com",
+ port: 587,
+ domain: "example.com",
+ authentication: "plain",
+ enable_starttls_auto: true,
+ user_name: ENV["GMAIL_USERNAME"],
+ password: ENV["GMAIL_PASSWORD"]
+ }
+
+ config.action_mailer.default_url_options = { :host => 'yourhostsite.herokuapp.com' }
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 5cede73..cf9ff7d 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -27,7 +27,7 @@
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
# Configure the class responsible to send e-mails.
- # config.mailer = 'Devise::Mailer'
+ config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
@@ -46,7 +46,7 @@
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
- # config.authentication_keys = [:email]
+ config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
@@ -219,7 +219,7 @@
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
- # config.reset_password_keys = [:email]
+ config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
@@ -228,7 +228,7 @@
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
- # config.sign_in_after_reset_password = true
+ config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
diff --git a/package.json b/package.json
index 23ce265..0dc5cf0 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,8 @@
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "5.2.1",
- "bootstrap": "^4.6.0",
- "jquery": "^3.5.1",
+ "bootstrap": "^5.0.0",
+ "jquery": "^3.6.0",
"popper.js": "^1.16.1",
"stimulus": "^2.0.0"
},
diff --git a/yarn.lock b/yarn.lock
index ccd6d66..58ff726 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1521,10 +1521,10 @@ boolbase@^1.0.0, boolbase@~1.0.0:
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
-bootstrap@^4.6.0:
- version "4.6.0"
- resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.6.0.tgz#97b9f29ac98f98dfa43bf7468262d84392552fd7"
- integrity sha512-Io55IuQY3kydzHtbGvQya3H+KorS/M9rSNyfCGCg9WZ4pyT/lCxIlpJgG1GXW/PswzC84Tr2fBYi+7+jFVQQBw==
+bootstrap@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.0.0.tgz#97635ac0e0d6cb466700ebf0fd266bfabf352ed2"
+ integrity sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==
brace-expansion@^1.1.7:
version "1.1.11"
@@ -4032,10 +4032,10 @@ jest-worker@^26.5.0:
merge-stream "^2.0.0"
supports-color "^7.0.0"
-jquery@^3.5.1:
- version "3.5.1"
- resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
- integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
+jquery@^3.6.0:
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
+ integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==
js-base64@^2.1.8:
version "2.6.4"