<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/layouts/_about.html.haml</filename>
    </added>
    <added>
      <filename>spec/views/authentications/new.haml_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,11 +4,17 @@ It does not matter how slowly you go as long as you do not stop.
 First they ignore you, then they laugh at you, then they fight you,
 then you win. &#8211;- Mahatma Gandhi
 
+Fri, Aug 20, 2009
+---------------------------------------------------------------------
+- Added new :user_signup setting (see config/settings.yml).
+- User signups are only allowed if :user_signup is set to :allowed or :needs_approval.
+
 Thu, Aug 20, 2009
 ---------------------------------------------------------------------
 - Added support for unattended [rake crm:setup] and [rake crm:setup:admin] tasks.
 - Warn about database reset in [rake crm:setup] task.
 - Removed dependency on Highline gem and removed it from vendors/gems.
+- Added [:user_signup] setting and started with the signup permissions.
 
 Wed, Aug 19, 2009
 ---------------------------------------------------------------------</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@
 
 class ApplicationController &lt; ActionController::Base
   helper(application_helpers)
-  helper_method :current_user_session, :current_user
+  helper_method :current_user_session, :current_user, :can_signup?
   helper_method :called_from_index_page?, :called_from_landing_page?
 
   filter_parameter_logging :password, :password_confirmation
@@ -88,6 +88,11 @@ class ApplicationController &lt; ActionController::Base
   end
 
   #----------------------------------------------------------------------------
+  def can_signup?
+    [ :allowed, :needs_approval ].include? Setting.user_signup
+  end
+
+  #----------------------------------------------------------------------------
   def called_from_index_page?(controller = controller_name)
     if controller != &quot;tasks&quot;
       request.referer =~ %r(/#{controller}$)</diff>
      <filename>app/controllers/application_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,7 +34,7 @@ class PasswordsController &lt; ApplicationController
       redirect_to root_url
     else
       flash[:notice] = &quot;No user was found with that email address.&quot;
-      render :action =&gt; :new
+      redirect_to :action =&gt; :new
     end
   end
   </diff>
      <filename>app/controllers/passwords_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -44,11 +44,15 @@ class UsersController &lt; ApplicationController
   # GET /users/new.xml                                                     HTML
   #----------------------------------------------------------------------------
   def new
-    @user = User.new
+    if can_signup?
+      @user = User.new
 
-    respond_to do |format|
-      format.html # new.html.haml &lt;-- signup form
-      format.xml  { render :xml =&gt; @user }
+      respond_to do |format|
+        format.html # new.html.haml &lt;-- signup form
+        format.xml  { render :xml =&gt; @user }
+      end
+    else
+      redirect_to login_path
     end
   end
   </diff>
      <filename>app/controllers/users_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,8 @@
   -# The following form gets submitted to #create when @authentication is nil,
   -# or to #update when @authentication is not nil (ex. suspended).
   - form_for @authentication, :url =&gt; authentication_path do |f|
-    .title_tools== Don't have an account? #{link_to 'Sign Up Now!', signup_path}
+    - if can_signup?
+      .title_tools== Don't have an account? #{link_to 'Sign Up Now!', signup_path}
     .title Login
     .warn= &quot;Invalid username or password&quot; unless f.error_messages.blank?
     .section
@@ -10,10 +11,9 @@
       = f.text_field :username
       .label Password:
       = f.password_field :password
-    .label
-      .check_box
-        = f.check_box(:remember_me) &lt;&lt; &quot; Remember me&quot;
 
+    %div(style=&quot;margin-left:12px&quot;) #{f.check_box(:remember_me)} Remember me
+    %br
     .buttonbar
       = f.submit &quot;Login&quot;
       or </diff>
      <filename>app/views/authentications/new.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,22 +1,6 @@
 #footer
   == Powered by #{link_to &quot;Fat Free CRM&quot;, &quot;http://www.fatfreecrm.com&quot;, :popup =&gt; true }
   == &amp;copy; 2008-#{Date.today.year} by Michael Dvorkin
-  == | #{link_to  &quot;About&quot;, &quot;#about&quot;, :rel =&gt; &quot;facebox&quot; }
+  == | #{link_to(&quot;About&quot;, &quot;#about&quot;, :rel =&gt; &quot;facebox&quot;)}
 %br
-#about{ hidden }
-  %h3
-    Fat Free CRM version
-    %span.cool== v#{FatFreeCRM::Version}
-    == (#{ActiveRecord::Base.connection.adapter_name.downcase})
-  %p
-    Thank you for using Fat Free CRM! We appreciate your business and hope
-    you enjoy using the software.
-    %p
-      Few resources that you might find helpful (links open in a new window):
-      %ul{:style =&gt; &quot;margin: 0px 0px 0px 15px&quot;}
-        %li== &amp;raquo; #{link_to &quot;Home page&quot;, &quot;http://www.fatfreecrm.com&quot;, :popup =&gt; true}
-        %li== &amp;raquo; #{link_to &quot;Project page&quot;, &quot;http://github.com/michaeldv/fat_free_crm/tree/master&quot;, :popup =&gt; true}
-        %li== &amp;raquo; #{link_to &quot;Features and bugs&quot;, &quot;http://fatfreecrm.lighthouseapp.com&quot;, :popup =&gt; true}
-        %li== &amp;raquo; #{link_to &quot;Twitter commit updates&quot;, &quot;http://twitter.com/fatfreecrm&quot;, :popup =&gt; true}
-        %li== &amp;raquo; #{link_to &quot;Discussion group for users&quot;, &quot;http://groups.google.com/group/fat-free-crm-users&quot;, :popup =&gt; true}
-        %li== &amp;raquo; #{link_to &quot;Discussion group for developers&quot;, &quot;http://groups.google.com/group/fat-free-crm-dev&quot;, :popup =&gt; true}
+= render :partial =&gt; &quot;layouts/about&quot;
\ No newline at end of file</diff>
      <filename>app/views/layouts/_footer.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@
       = render :partial =&gt; &quot;/layouts/jumpbox&quot;
     - else
       = link_to(&quot;Login&quot;, login_path) &lt;&lt; &quot; |&quot;
-      = link_to(&quot;Sign Up&quot;, signup_path)
-      -# link_to(&quot;Help&quot;, &quot;/&quot;)
+      = link_to(&quot;Sign Up&quot;, signup_path) if can_signup?
+      = link_to(&quot;About&quot;, &quot;#about&quot;, :rel =&gt; &quot;facebox&quot;)
   %h3
     = link_to(&quot;Fat Free CRM&quot;, root_path)</diff>
      <filename>app/views/layouts/_header.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,4 @@
 = show_flash(:sticky =&gt; true)
-.tabless= yield
\ No newline at end of file
+.tabless= yield
+%br
+= render :partial =&gt; &quot;layouts/about&quot;
\ No newline at end of file</diff>
      <filename>app/views/layouts/_tabless.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -4,15 +4,14 @@
     %meta{ &quot;http-equiv&quot; =&gt; &quot;Content-Type&quot;, :content =&gt; &quot;text/html; charset=utf-8&quot; }
     %title Fat Free CRM
     == &lt;!-- #{controller.controller_name} : #{controller.action_name} --&gt;
-    = stylesheet_link_tag &quot;screen&quot;, :cache =&gt; &quot;cache/all&quot;
+    = stylesheet_link_tag &quot;screen&quot;, &quot;/facebox/facebox.css&quot;, :cache =&gt; &quot;cache/all&quot;
     - unless tabless_layout?
       = stylesheet_link_tag &quot;calendar_date_select/default.css&quot;
-      = stylesheet_link_tag &quot;/facebox/facebox.css&quot;
     %style= yield :styles
 
-    = javascript_include_tag :defaults, :cache =&gt; &quot;cache/all&quot;
+    = javascript_include_tag :defaults, &quot;/facebox/facebox.js&quot;, :cache =&gt; &quot;cache/all&quot;
     - unless tabless_layout?
-      = javascript_include_tag &quot;crm_classes.js&quot;, &quot;calendar_date_select/calendar_date_select.js&quot;, &quot;calendar_date_select/format_american.js&quot;, &quot;/facebox/facebox.js&quot;, :cache =&gt; &quot;cache/classes&quot;
+      = javascript_include_tag &quot;crm_classes.js&quot;, &quot;calendar_date_select/calendar_date_select.js&quot;, &quot;calendar_date_select/format_american.js&quot;, :cache =&gt; &quot;cache/classes&quot;
     %script{:type =&gt; &quot;text/javascript&quot;}= yield :javascript
 
   %body</diff>
      <filename>app/views/layouts/application.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -8,5 +8,6 @@
       = f.password_field :password
       .label Password confirmation:
       = f.password_field :password_confirmation
+    %br
     .buttonbar
       = f.submit &quot;Update Password and Login&quot;</diff>
      <filename>app/views/passwords/edit.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -5,5 +5,6 @@
     .section
       .label Email address:
       = text_field_tag :email
+    %br
     .buttonbar
       = submit_tag &quot;Reset Password&quot;</diff>
      <filename>app/views/passwords/new.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@
 # along with this program.  If not, see &lt;http:#www.gnu.org/licenses/&gt;.
 #------------------------------------------------------------------------------
 
-# Defaul applications settings to be loaded during installation:
+# Default application settings to be loaded during installation:
 #
 #   rake crm:settings:load
 #
@@ -35,6 +35,13 @@
   { :active : true,  :text : &quot;Plugins&quot;,       :url : { :controller : &quot;admin/plugins&quot;  } }
 ]
 
+# The following setting controls user signup. Possible values are:
+#   :allowed        -- users can sign up and use the system once they have registered.
+#   :needs_approval -- users can sign up but must be approved before they can use the system.
+#   :not_allowed    -- users can only be added by system administrator. This is the default.
+
+:user_signup: :not_allowed
+
 campaign_status:
   :planned       : Planned
   :started       : Started</diff>
      <filename>config/settings.yml</filename>
    </modified>
    <modified>
      <diff>@@ -71,13 +71,25 @@ describe UsersController do
   #----------------------------------------------------------------------------
   describe &quot;responding to GET new&quot; do
   
-    it &quot;should expose a new user as @user and render [new] template&quot; do
-      @user = Factory.build(:user)
-      User.stub!(:new).and_return(@user)
+    describe &quot;if user is allowed to sign up&quot; do
+      it &quot;should expose a new user as @user and render [new] template&quot; do
+        controller.should_receive(:can_signup?).and_return(true)
+        @user = Factory.build(:user)
+        User.stub!(:new).and_return(@user)
 
-      get :new
-      assigns[:user].should == @user
-      response.should render_template(&quot;users/new&quot;)
+        get :new
+        assigns[:user].should == @user
+        response.should render_template(&quot;users/new&quot;)
+      end
+    end
+
+    describe &quot;if user is not allowed to sign up&quot; do
+      it &quot;should redirect to login_path&quot; do
+        controller.should_receive(:can_signup?).and_return(false)
+
+        get :new
+        response.should redirect_to(login_path)
+      end
     end
 
   end</diff>
      <filename>spec/controllers/users_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -49,6 +49,12 @@ end
 # Load default settings from config/settings.yml
 Factory(:default_settings)
 
+# See vendor/plugins/authlogic/lib/authlogic/test_case.rb
+#----------------------------------------------------------------------------
+def activate_authlogic
+  Authlogic::Session::Base.controller = (@request &amp;&amp; Authlogic::TestCase::RailsRequestAdapter.new(@request)) || controller
+end
+
 # Note: Authentication is NOT ActiveRecord model, so we mock and stub it using RSpec.
 #----------------------------------------------------------------------------
 def login(user_stubs = {}, session_stubs = {})</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>319129b24dda3ec90d807c62cd209dab846c998b</id>
    </parent>
  </parents>
  <author>
    <name>Mike Dvorkin</name>
    <email>mike@dvorkin.net</email>
  </author>
  <url>http://github.com/enderson/fat_free_crm/commit/07be9dd7864568f4318aca911f4b08d600bac543</url>
  <id>07be9dd7864568f4318aca911f4b08d600bac543</id>
  <committed-date>2009-08-21T22:28:44-07:00</committed-date>
  <authored-date>2009-08-21T22:28:44-07:00</authored-date>
  <message>Added new :user_signup setting (see config/settings.yml); user signups are only allowed if :user_signup is set to :allowed or :needs_approval
[#29 state:open]</message>
  <tree>ae4abda7a4c33e654a64058a2a0263b3a6de6215</tree>
  <committer>
    <name>Mike Dvorkin</name>
    <email>mike@dvorkin.net</email>
  </committer>
</commit>
