Sha256: 4882ac69c5123926e102e2eeba22649f202127bb971d14a8e50f69009e2c91a1
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
class Janus::RegistrationsController < ApplicationController include Janus::InternalHelpers helper JanusHelper before_filter :authenticate!, :except => [:new, :create] skip_before_filter :authenticate!, :only => [:new, :create] def new self.resource = resource_class.new respond_with(resource) end def edit self.resource = send("current_#{janus_scope}") respond_with(resource) end def create self.resource = resource_class.new(send("#{janus_scope}_params")) if resource.save janus.login(resource, :scope => janus_scope, :rememberable => true) mailer_class.confirmation_instructions(resource).deliver if resource.respond_to?(:confirm!) else resource.clean_up_passwords end respond_with(resource, :location => after_sign_up_url(resource)) end def update self.resource = send("current_#{janus_scope}") resource.current_password = "" resource.clean_up_passwords unless resource.update_attributes(resource_params) respond_with(resource, :location => after_sign_up_url(resource)) end def destroy self.resource = send("current_#{janus_scope}") janus.unset_user(janus_scope) if resource.destroy respond_with(resource) do |format| format.html { redirect_to root_url } end end def after_sign_up_url(user) user end def resource_params keys = %w{current_password password password_confirmation} send("#{janus_scope}_params").reject do |key, value| value.blank? and keys.include?(key) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
janus-0.8.1 | lib/janus/controllers/registrations_controller.rb |
janus-0.8.0 | lib/janus/controllers/registrations_controller.rb |