Sha256: 02cf23881df0ddb883afb681616e9d65e6fe89eb75d748c3754a38953370f244
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
class ReaderActivationsController < ReaderActionController helper :reader no_login_required skip_before_filter :require_reader before_filter :authenticate_reader, :only => [:update] before_filter :check_reader_inactive radiant_layout { |controller| Radiant::Config['reader.layout'] } # this is just fake REST: we're actually working on the reader, not an activation object. # .show sends out an activation message if we can identify the current reader # .update activates the reader, if the token is correct def show expires_now render end def new if current_reader @reader = current_reader @reader.send_activation_message flash[:notice] = t("reader_extension.activation_message_sent") end expires_now render :action => 'show' end def update if @reader @reader.activate! self.current_reader = @reader else @error = t("reader_extension.please_check_message") end expires_now render :action => 'show' end protected def authenticate_reader # not using authlogic's find_using_perishable_token because I don't want the token to expire @reader = Reader.find_by_id_and_perishable_token(params[:id], params[:activation_code]) end def check_reader_inactive if @reader && @reader.activated? flash[:notice] = t('reader_extension.hello').titlecase + " #{@reader.name}! " + t('reader_extension.already_active') redirect_back_or_to default_welcome_url(@reader) false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
radiant-reader-extension-2.0.0.rc4 | app/controllers/reader_activations_controller.rb |