fixing functional tests

This commit is contained in:
albert
2011-07-17 16:42:26 -04:00
parent 04ab2f4701
commit 72e9da01b5
26 changed files with 446 additions and 46 deletions

View File

@@ -0,0 +1,20 @@
module Maintenance
module User
class LoginRemindersController < ApplicationController
def new
end
def create
@user = ::User.with_email(params[:user][:email]).first
if @user
LoginReminderMailer.notice(@user).deliver
flash[:notice] = "Email sent"
else
flash[:notice] = "Email address not found"
end
redirect_to new_maintenance_user_login_reminder_path
end
end
end
end

View File

@@ -0,0 +1,34 @@
module Maintenance
module User
class PasswordResetsController < ApplicationController
def new
@nonce = UserPasswordResetNonce.new
end
def create
@nonce = UserPasswordResetNonce.create(params[:nonce])
if @nonce.errors.any?
redirect_to new_maintenance_user_password_reset_path, :notice => @nonce.errors.full_messages.join("; ")
else
redirect_to new_maintenance_user_password_reset_path, :notice => "Email request sent"
end
end
def edit
@nonce = UserPasswordResetNonce.where(:email => params[:email], :key => params[:key]).first
end
def update
@nonce = UserPasswordResetNonce.where(:email => params[:email], :key => params[:key]).first
if @nonce
@nonce.reset_user!
@nonce.destroy
redirect_to new_maintenance_user_password_reset_path, :notice => "Password reset; email delivered with new password"
else
redirect_to new_maintenance_user_password_reset_path, :notice => "Invalid key"
end
end
end
end
end

View File

@@ -1,25 +0,0 @@
class UserMaintenanceController < ApplicationController
def login_reminder
if request.post?
@user = User.with_email(params[:user][:email]).first
if @user
UserMaintenanceMailer.login_reminder(@user).deliver
flash[:notice] = "Email sent"
else
flash[:notice] = "No matching user record found"
end
end
end
def reset_password
if request.post?
@user = User.find_for_password_reset(params[:user][:name], params[:user][:email]).first
if @user
@user.reset_password_and_deliver_notice
flash[:notice] = "Email sent"
else
flash[:notice] = "No matching user record found"
end
end
end
end

View File

@@ -3,7 +3,7 @@ class WikiPageVersionsController < ApplicationController
def index
@search = WikiPageVersion.search(params[:search])
@wiki_page_versions = @search.paginate(:page => params[:page])
@wiki_page_versions = @search.paginate(params[:page])
respond_with(@wiki_page_versions)
end