2009-12-30 12:19:33 -05:00
|
|
|
class UnlocksController < ApplicationController
|
2010-01-13 12:12:13 -05:00
|
|
|
include Devise::Controllers::InternalHelpers
|
|
|
|
include Devise::Controllers::Common
|
2009-12-30 12:19:33 -05:00
|
|
|
|
|
|
|
# GET /resource/unlock?unlock_token=abcdef
|
|
|
|
def show
|
|
|
|
self.resource = resource_class.unlock!(:unlock_token => params[:unlock_token])
|
|
|
|
|
|
|
|
if resource.errors.empty?
|
2010-01-20 14:46:14 -05:00
|
|
|
set_flash_message :notice, :unlocked
|
2009-12-30 12:19:33 -05:00
|
|
|
sign_in_and_redirect(resource_name, resource)
|
|
|
|
else
|
|
|
|
render_with_scope :new
|
|
|
|
end
|
|
|
|
end
|
2010-01-13 12:12:13 -05:00
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def send_instructions_with
|
|
|
|
:send_unlock_instructions
|
|
|
|
end
|
2009-12-30 12:19:33 -05:00
|
|
|
end
|