From 42f399c89be702fde8fe8d749b6088225f190b24 Mon Sep 17 00:00:00 2001 From: Rit Li Date: Thu, 27 Aug 2009 11:48:17 -0700 Subject: [PATCH 1/2] unsuspended admin user generated from "rake crm:setup:admin" --- lib/tasks/fat_free_crm.rake | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/tasks/fat_free_crm.rake b/lib/tasks/fat_free_crm.rake index 8590109..a2af4e4 100644 --- a/lib/tasks/fat_free_crm.rake +++ b/lib/tasks/fat_free_crm.rake @@ -99,6 +99,8 @@ namespace :crm do end user = User.find_by_username(username) || User.new user.update_attributes(:username => username, :password => password, :email => email, :admin => true) + user.suspended_at = nil # override the User#check_if_needs_approval + user.save puts "Admin user has been created." end end -- 1.6.4.1 From 99e8fe2a00c03ee6c7a9f793329074186301b048 Mon Sep 17 00:00:00 2001 From: Rit Li Date: Thu, 27 Aug 2009 12:13:16 -0700 Subject: [PATCH 2/2] checking for @authentication.user is not nil --- app/controllers/authentications_controller.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index 3a008aa..d3c6b3a 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -36,7 +36,7 @@ class AuthenticationsController < ApplicationController end redirect_back_or_default root_url else - if @authentication.user.awaits_approval? + if @authentication.user && @authentication.user.awaits_approval? flash[:notice] = "Your account has not been approved yet." else flash[:warning] = "Invalid username or password." -- 1.6.4.1