Sha256: d2ee1e5dc0be4d14222f0c0917f2682b4ab2fe4226c3d11e024fa8f188675b29
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 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(params[resource_name]) if resource.save janus.login(resource, :scope => janus_scope, :rememberable => true) JanusMailer.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 params[resource_name].each do |key, value| params[resource_name].delete(key) if value.blank? && [:password, :password_confirmation].include?(key.to_sym) end self.resource = send("current_#{janus_scope}") resource.current_password = "" resource.clean_up_passwords unless resource.update_attributes(params[resource_name]) 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
janus-0.6.0 | lib/janus/controllers/registrations_controller.rb |
janus-0.5.0 | lib/janus/controllers/registrations_controller.rb |