From f4ed3e17294bebf1439b2d5ce01c05ee9ffd2b80 Mon Sep 17 00:00:00 2001 From: sennui Date: Wed, 11 Mar 2020 10:27:49 +0100 Subject: [PATCH] preserve auth entry after logout --- apps/roster/src/protocol/micro_auth.erl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/roster/src/protocol/micro_auth.erl b/apps/roster/src/protocol/micro_auth.erl index 5508c1acb..00a0ef818 100644 --- a/apps/roster/src/protocol/micro_auth.erl +++ b/apps/roster/src/protocol/micro_auth.erl @@ -45,12 +45,11 @@ check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, AuthPid = n2o_async:pid(system, ?MODULE), Ver = binary_to_list(BVer), case kvs:get('Auth', ClientId) of - {ok, #'Auth'{user_id = PhoneId, type = logout}} -> - FreshAuth = #'Auth'{user_id = PhoneId, phone = roster:phone(PhoneId), - last_online = roster:now_msec(), type = verified}, - kvs:put(FreshAuth), + {ok, #'Auth'{user_id = PhoneId, type = logout} = Auth0} -> + Auth1 = Auth0#'Auth'{last_online = roster:now_msec(), type = verified}, + kvs:put(Auth1), roster:info(?MODULE, "~p:Auth:auth(micro)/check:session created, post logout ", [ClientId]), - AuthPid ! roster_auth:control_ver(FreshAuth, Ver), + AuthPid ! roster_auth:control_ver(Auth1, Ver), ok; {ok, #'Auth'{user_id = PhoneId} = Auth} -> AuthPid ! roster_auth:control_ver(Auth#'Auth'{type = []}, Ver), -- GitLab