From a13063b2049ab14b4776eaaed3fcb94f61fb39ed Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Fri, 27 Dec 2024 15:34:37 +0000 Subject: [PATCH] Moved `get_key` into API route --- lib/GADS.pm | 11 ----------- lib/GADS/API.pm | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/GADS.pm b/lib/GADS.pm index b7e2bac90..529d8b817 100644 --- a/lib/GADS.pm +++ b/lib/GADS.pm @@ -4489,17 +4489,6 @@ prefix '/:layout_name' => sub { }; -get '/get_key' => require_login sub { - my $user = logged_in_user; - - my $key = $user->encryption_key; - - return to_json { - error => 0, - key => $key - } -}; - sub reset_text { my ($dsl, %options) = @_; my $site = var 'site'; diff --git a/lib/GADS/API.pm b/lib/GADS/API.pm index 42a08c4cc..1ebd96649 100644 --- a/lib/GADS/API.pm +++ b/lib/GADS/API.pm @@ -1448,6 +1448,17 @@ any ['get', 'post'] => '/api/users' => require_any_role [qw/useradmin superadmin return encode_json $return; }; +get '/api/get_key' => require_login sub { + my $user = logged_in_user; + + my $key = $user->encryption_key; + + return to_json { + error => 0, + key => $key + } +}; + sub _success { my $msg = shift; send_as JSON => {