Class: ReaderActivationsController

Inherits:
ReaderActionController show all
Defined in:
app/controllers/reader_activations_controller.rb

Instance Method Summary collapse

Methods inherited from ReaderActionController

#default_welcome_url, #logged_in?, #logged_in_admin?, #logged_in_user?, #permission_denied

Instance Method Details

#newObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/reader_activations_controller.rb', line 21

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

#showObject

this is just fake REST: we’re actually working on the reader, not an activation object. .new sends out an activation message, if we can identify the current reader .update updates the reader, if the supplied token and reader id match .show displays the activation in progress, ie it says ‘check your email’



16
17
18
19
# File 'app/controllers/reader_activations_controller.rb', line 16

def show
  expires_now
  render
end

#updateObject



31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/reader_activations_controller.rb', line 31

def update
  if @reader
    @reader.activate!
    self.current_reader = @reader
    redirect_to default_welcome_url(@reader)
  else
    @error = t("reader_extension.please_check_message")
    expires_now
    render :action => 'show'
  end
end