Commit b5f92749 by Xuan Trung Le

update reset_password page

parent fefcd9b2
class PasswordsController < Devise::PasswordsController
def new
super
end
def edit
self.resource = User.with_reset_password_token(params[:reset_password_token])
if self.resource
set_minimum_password_length
resource.reset_password_token = params[:reset_password_token]
else
flash[:notice] = 'was already confirmed, please try signing in'
redirect_to root_path
end
end
end
......@@ -23,7 +23,9 @@
<div class="form-group">
<%= f.label :cv, 'Cv:',class: "control-label col-md-2" %>
<div class="col-sm-10">
<%= f.text_field :cv, class: "form-control" %>
<label for="apply_job_cv"><%= @application.cv %></label>
<%= f.file_field :cv, class: "form-control" %>
</label>
</div>
</div>
......
<p>Dear <%= @resource.name %>!</p>
<p>You have a new password!</p>
<p>Your password for signing in to VenJOB was recently changed. If you made this change, then we're all set.</p>
<p>If you did not make this change, please reset your password to secure your account. Then reply to this email to notify us.</p>
<p>Either way, feel free to reach out with any questions you might have. We're here to help.</p>
<p>Best,</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>
<p>Click the link below to reset your password using our secure server:.</p>
<p><%= link_to 'Reset your password', edit_password_url(@resource, reset_password_token: @token) %></p>
<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>
<div class="row">
<div class="container">
<h2>Change your password</h2>
<%=form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="form-inputs form-group">
<%= f.hidden_field :reset_password_token %>
</div>
<div class="form-inputs form-group">
<%= f.label :email, "Email" %><br />
<%= f.email_field :email, required: true, class: "form-control", disabled: true %>
</div>
<div class="form-inputs form-group">
<%= f.label :password, "New password" %><br />
<%= f.password_field :password,
class: 'form-control',
required: true,
autofocus: true,
hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
</div>
<div class="form-inputs form-group">
<%= f.label :password, "Confirm password" %><br />
<%= f.password_field :password_confirmation, required: true, class: "form-control" %>
</div>
<div class="form-actions">
<%= submit_tag "Submit", class: "btn btn-danger form-control" %>
</div>
<% end %>
</div>
</div>
<div class="row">
<div class="container">
<h2>Forgot your password?</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<div class="form-inputs form-group">
<%= f.text_field :email, required: true, autofocus: true, class: "form-control" %>
</div>
<div class="form-actions form-group">
<%= submit_tag "Confirm", class: "btn btn-primary" %>
</div>
<% end %>
</div>
</div>
......@@ -12,11 +12,14 @@
</div>
<% if devise_mapping.rememberable? -%>
<div class="field form-group">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end -%>
<div class="field form-group">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<%= link_to "Forgot password?", forgot_password_path %>
</div>
<% end -%>
<div class="actions form-group">
<%= f.submit "Log in", class: "btn btn-default" %>
......
......@@ -47,7 +47,7 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { protocol: 'http', host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost',
port: 1025 }
......
......@@ -12,7 +12,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 = 'notify@venjob.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
......@@ -114,7 +114,7 @@ Devise.setup do |config|
# config.send_email_changed_notification = false
# Send a notification email when the user's password is changed.
# config.send_password_change_notification = false
config.send_password_change_notification = true
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
......
......@@ -20,13 +20,13 @@ en:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
subject: "VeNJOB Password Assistance"
unlock_instructions:
subject: "Unlock instructions"
email_changed:
subject: "Email Changed"
password_change:
subject: "Password Changed"
subject: "VeNJOB Password Assistance: Your password has been reset"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
......
Rails.application.routes.draw do
require 'sidekiq/web'
root 'jobs#index'
devise_for :users, :controllers => {registrations: 'registrations'}
devise_for :users, controllers: { registrations: 'registrations', passwords: 'passwords' }
as :user do
get 'register/:step', to: 'registrations#new', as: :register
patch 'complete_registering' => 'registrations#complete_registering_user'
get 'forgot_password' => 'passwords#new'
get 'reset_password' => 'password#edit'
end
resources :cities, only: [:index, :show]
......
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