Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proyecto 36 #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions app/models/recoverable.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<div class="row">
<div class="col-12">
<%= render partial: 'shared/navigation_bar' %>

<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 } %>
Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.