Class: Devise::PasswordExpiredController

Inherits:
DeviseController
  • Object
show all
Defined in:
app/controllers/devise/password_expired_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/devise/password_expired_controller.rb', line 6

def show
  if defined?(MnoEnterprise::Frontend)
    respond_with(resource)
  else
    respond_with resource do |format|
      format.html
      format.json {render json: {error: 'Your password is expired. Please renew your password.'}, status: :forbidden}
    end
  end
end

#updateObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/devise/password_expired_controller.rb', line 17

def update
  # resource.extend(Devise::Models::DatabaseAuthenticatablePatch)
  if resource.update(resource_params.merge(current_password_required: true))
    warden.session(scope)['password_expired'] = false
    set_flash_message :notice, :updated
     scope, resource, :bypass => true
    redirect_to mnoe_home_path
  else
    clean_up_passwords(resource)
    respond_with(resource, action: :show)
  end
end