Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 35 lines (29 sloc) 0.878 kB
02e8c04 @josevalim Update views generator and now have scoped views.
josevalim authored
1 class Devise::UnlocksController < ApplicationController
a5ba2ac @carlosantoniodasilva Use prepend_before_filter in require_no_authentication.
carlosantoniodasilva authored
2 prepend_before_filter :require_no_authentication
b581f86 @josevalim DRY up controllers.
josevalim authored
3 include Devise::Controllers::InternalHelpers
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
4
5 # GET /resource/unlock/new
6 def new
0aa41d6 @josevalim Tidy up lose ends.
josevalim authored
7 build_resource({})
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
8 render_with_scope :new
9 end
10
11 # POST /resource/unlock
12 def create
13 self.resource = resource_class.send_unlock_instructions(params[resource_name])
14
15 if resource.errors.empty?
16 set_flash_message :notice, :send_instructions
17 redirect_to new_session_path(resource_name)
18 else
19 render_with_scope :new
20 end
21 end
d2fa737 @mhfs introducing lockable implementation
mhfs authored
22
23 # GET /resource/unlock?unlock_token=abcdef
24 def show
ac742e3 @josevalim Clean up lockable and class methods API.
josevalim authored
25 self.resource = resource_class.unlock_access_by_token(params[:unlock_token])
d2fa737 @mhfs introducing lockable implementation
mhfs authored
26
27 if resource.errors.empty?
6d80418 @carlosantoniodasilva Changing flash messages to new Rails defaults :notice/:alert
carlosantoniodasilva authored
28 set_flash_message :notice, :unlocked
d2fa737 @mhfs introducing lockable implementation
mhfs authored
29 sign_in_and_redirect(resource_name, resource)
30 else
31 render_with_scope :new
32 end
33 end
34 end
Something went wrong with that request. Please try again.