Wire up forgot password action

This commit is contained in:
Erik Michaels-Ober 2011-03-06 18:32:11 -08:00
parent 135d017d2c
commit b61f81a9d0
4 changed files with 19 additions and 14 deletions

View File

@ -1,6 +1,3 @@
class SitemapsController < ApplicationController
respond_to :xml
def index
end
end

View File

@ -53,7 +53,7 @@
$('.combo_form').data('state', 'user_new');
$('.combo_form').submit(function() {
var errors = []
if(!/[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/.test($('#user_email').val())) {
if(!/\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i.test($('#user_email').val())) {
errors.push($('#user_email'));
$('#user_email_label').addClass('error', 500);
$('#user_email').addClass('error', 500);
@ -124,7 +124,14 @@
if(errors.length > 0) {
errors[0].focus();
} else {
$.post('<%= user_password_path :format => "json" %>', $(this).serialize(), function(data) {
$.post('<%= user_password_path :format => "json" %>', {
'remote' : true,
'commit' : $('#user_forgot_password_submit').val(),
'utf8' : '✓',
'user' : {
'email' : $('#user_email').val()
}
}, function(data) {
});
}
}

View File

@ -3,10 +3,10 @@
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "please-change-me@config-initializers-devise.com"
config.mailer_sender = "noreply@adoptahydrant.com"
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
config.mailer = "Devise::Mailer"
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
@ -59,20 +59,20 @@ Devise.setup do |config|
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
config.remember_for = 2.weeks
# If true, a valid remember token can be re-used between multiple browsers.
# config.remember_across_browsers = true
config.remember_across_browsers = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
config.extend_remember_period = false
# ==> Configuration for :validatable
# Range for password length
# config.password_length = 6..20
config.password_length = 6..20
# Regex to use to validate the email address
# config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
@ -111,7 +111,7 @@ Devise.setup do |config|
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes.
# config.default_scope = :user
config.default_scope = :user
# Configure sign_out behavior.
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).

View File

@ -1,7 +1,8 @@
AdoptAHydrant::Application.routes.draw do
devise_for :users, :controllers => {
:passwords => 'passwords',
:registrations => 'users',
:sessions => 'sessions'
:sessions => 'sessions',
}
resource :user
get 'sitemap(.format)' => 'sitemaps#index', :as => 'sitemap'