summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-08-24 13:02:16 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-08-24 13:02:16 +0200 |
commit | 67345d58c55e513f9b11a5b3e1af33164a4103ef (patch) | |
tree | f8352892fdc002d43bf4b4d381264262351cabd1 /src/map/query/map_load.erl | |
parent | 6b1f8c043b61d27be473b90cf79a09a49297ce0f (diff) |
Working on the character editor...
Diffstat (limited to 'src/map/query/map_load.erl')
-rw-r--r-- | src/map/query/map_load.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/map/query/map_load.erl b/src/map/query/map_load.erl index 8365521..3357c4f 100644 --- a/src/map/query/map_load.erl +++ b/src/map/query/map_load.erl @@ -48,6 +48,17 @@ parse_input (Req) -> map_id = MapID }. +-spec authenticate_user (input()) -> 'ok'. +authenticate_user (Input) -> + PlayerID = Input#input.player_id, + SessionToken = Input#input.session_token, + + Player = shr_timed_cache:fetch(player_db, any, PlayerID), + + shr_security:assert_identity(SessionToken, Player), + + ok. + -spec fetch_data (input()) -> query_state(). fetch_data (Input) -> PlayerID = Input#input.player_id, @@ -72,11 +83,7 @@ generate_reply (QueryState) -> -spec handle (binary()) -> binary(). handle (Req) -> Input = parse_input(Req), - shr_security:assert_identity - ( - Input#input.player_id, - Input#input.session_token - ), + authenticate_user(Input), shr_security:lock_queries(Input#input.player_id), QueryState = fetch_data(Input), shr_security:unlock_queries(Input#input.player_id), |