Commit f853348f by Son Do Hong

Merge branch 'feature/password_reset' into 'master'

Feature/password reset (local)

See merge request !11
parents 27e07bd1 fc51c93d
class UserMailer < ActionMailer::Base
include Devise::Mailers::Helpers
default :from => ENV["EMAIL_ADDRESS"]
end
<p>Hello <%= @email %>!</p>
<% if @resource.try(:unconfirmed_email?) %>
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
<% else %>
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
<% end %>
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>
<p>Hello <%= @resource.email %>!</p>
<p>
We received a request to reset the password associated with this e-mail address.
If you made this request, please follow the instructions below.
</p><br>
<p>Click the link below to reset your password using our secure server:</p>
<p><%= link_to "Change my password", edit_password_url(@resource, reset_password_token: @token) %></p>
<br>
<p>
If you did not request to have your password reset you can safely ignore this email.
Rest assured your account is safe.
</p>
<p>Please also be noted that the above link is valid for 24 hours.</p>
<p>Best,</p>
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render "users/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="form-group">
<%= f.label :password, "New password" %><br/>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br/>
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Submit" %>
</div>
<% end %>
<h2>Forgot password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= render "users/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %><br/>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Confirm your email", class: "btn btn-primary" %>
</div>
<% end %>
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<%- if controller_name != "sessions" %>
<%= link_to "Log in", new_session_path(resource_name) %><br/>
<% end %>
<%- if devise_mapping.registerable? && controller_name != "registrations" %>
<%= link_to "Register", new_registration_path(resource_name) %><br />
<%= link_to "Sign up", new_registration_path(resource_name) %><br/>
<% end %>
<%- if devise_mapping.recoverable? && controller_name != "passwords" && controller_name != "registrations" %>
<%= link_to "Forgot password?", new_password_path(resource_name) %><br />
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br/>
<% end %>
<%- if devise_mapping.confirmable? && controller_name != "confirmations" %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br/>
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != "unlocks" %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br/>
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br/>
<% end %>
<% end %>
......@@ -60,5 +60,10 @@ Rails.application.configure do
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
#Mailcatcher
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
end
......@@ -18,7 +18,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
config.mailer_sender = "venjob-mailer@mail.com"
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
......@@ -212,7 +212,7 @@ Devise.setup do |config|
# 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
# change their passwords.
config.reset_password_within = 6.hours
config.reset_password_within = 24.hours
# 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment