Commit 6c886a74 authored by mh's avatar mh
Browse files

unify session destroy

parent 63f57acc
......@@ -62,4 +62,9 @@ class ApplicationController < ActionController::Base
session[:expires_at] = 15.minutes.from_now.to_i
end
helper_method :update_session_expiry
private
def destroy_session
session[:user_id] = nil
session[:trees_recovery_token] = nil
end
end
......@@ -4,8 +4,9 @@ class DeleteAccountController < ApplicationController
begin
ApiBackend::delete_account(current_user, p)
flash[:notice] = :delete_success
session[:user_id] = nil
destroy_session
redirect_to '/'
return
rescue ApiBackend::ApiError => e
if e.api_msg == 'auth_fail'
flash[:notice] = :auth_fail
......
......@@ -58,8 +58,7 @@ class SessionsController < ApplicationController
end
def destroy
session[:user_id] = nil
session[:trees_recovery_token] = nil
destroy_session
redirect_to '/login'
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment