Sha256: 943313bffa545d3fda4cbba2fb861c1c04b5cb82ea9c902ca78e2c79d25cf7a2

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

#    This file is part of Branston.
#
#    Branston is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation.
#
#    Branston is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with Branston.  If not, see <http://www.gnu.org/licenses/>.

class UsersController < ApplicationController

  layout 'main'

  # render new.rhtml
  def new
    @user = User.new
  end

  def create
    logout_keeping_session!
    @user = User.new(params[:user])
    success = @user && @user.save
    if success && @user.errors.empty?
      # Protects against session fixation attacks, causes request forgery
      # protection if visitor resubmits an earlier form using back
      # button. Uncomment if you understand the tradeoffs.
      # reset session
      self.current_user = @user # !! now logged in
      redirect_back_or_default('/')
      flash[:notice] = "Thanks for signing up!  We're sending you an email with your activation code."
    else
      flash[:error]  = "We couldn't set up that account, sorry.  Please try again, or contact an admin (link is above)."
      render :action => 'new'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
branston-0.6.1 lib/branston/app/controllers/users_controller.rb
branston-0.6.0 lib/branston/app/controllers/users_controller.rb
branston-0.5.2 lib/branston/app/controllers/users_controller.rb
branston-0.5.1 lib/branston/app/controllers/users_controller.rb
branston-0.5.0 lib/branston/app/controllers/users_controller.rb
branston-0.4.6 lib/branston/app/controllers/users_controller.rb
branston-0.4.5 lib/branston/app/controllers/users_controller.rb
branston-0.4.4 lib/branston/app/controllers/users_controller.rb
branston-0.4.3 lib/branston/app/controllers/users_controller.rb