PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.4.5
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.4.5
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/API/Login.php +2 -41 3.7.03.4.5 View file →
@@ -17,12 +17,8 @@
17 17 if ( '/templately/v1/pricing' === $_route ) {
18 18 return true;
19 19 }
20 20
21 - if ( '/templately/v1/google-auth-url' === $_route ) {
22 - return true;
23 - }
24 -
25 21 return parent::permission_check( $request );
26 22 }
27 23
28 24 public function register_routes() {
@@ -29,25 +25,10 @@
29 25 $this->post( 'login', [$this, 'login'] );
30 26 $this->post( 'logout', [$this, 'logout'] );
31 27 $this->get( 'is-signed', [$this, 'is_signed'] );
32 28 $this->get( 'pricing', [$this, 'pricing'] );
33 - $this->get( 'google-auth-url', [$this, 'google_auth_url'] );
34 29 }
35 30
36 - public function google_auth_url() {
37 - // Get redirect_to parameter from request if provided
38 - $redirect_to = $this->get_param( 'redirect-to', '' );
39 -
40 - // Use client-provided current_url instead of HTTP_REFERER for reliability
41 - $current_url = $this->get_param( 'current_url', '' );
42 -
43 - $url = $this->http()->google_auth_url( $redirect_to, $current_url );
44 - return [
45 - 'status' => 'success',
46 - 'url' => $url
47 - ];
48 - }
49 -
50 31 public function pricing(){
51 32 $data = get_transient( "templately_subscriptions" );
52 33
53 34 if( is_array( $data ) && ! empty( $data ) ) {
@@ -105,9 +86,9 @@
105 86 if ( ! empty( $errors ) ) {
106 87 return $this->error( 'login_error', $errors, 'login', 400 );
107 88 }
108 89
109 - $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, is_company_user, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating }, subscription { id, name, sites } }';
90 + $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating } }';
110 91
111 92 $response = $this->http()->mutation(
112 93 $viaAPI ? 'connectWithApiKey' : 'connect',
113 94 $query,
@@ -117,12 +98,8 @@
117 98 if ( is_wp_error( $response ) ) {
118 99 return $response;
119 100 }
120 101
121 - if ( empty( $response['user']['api_key'] ) ) {
122 - return $this->error( 'login_error', $response['message'] ?? __('Invalid API key.', 'templately'), 'login', 400 );
123 - }
124 -
125 102 if ( $global_signin && ! Login::is_globally_signed() ) {
126 103 Options::set_global_login();
127 104 }
128 105
@@ -158,17 +135,10 @@
158 135 unset( $response['user']['reviews'] );
159 136 $meta['reviews'] = $_reviews;
160 137 }
161 138
162 - if(Helper::is_dev_api()){
163 - $response['user']['is_dev_api'] = true;
164 - }
139 + // No longer need to manage is_live_api state - API selection is now handled by TEMPLATELY_DEV_API constant
165 140
166 - if(! empty( $response['user'] ) && is_array($response['user'])){
167 - $response['user']['ip'] = $_ip;
168 - $response['user']['site_url'] = base64_encode( $_site_url );
169 - }
170 -
171 141 $this->utils( 'options' )->set( 'user', $response['user'] );
172 142 $response['user']['meta'] = $this->user_meta( $meta );
173 143
174 144 return $response;
@@ -228,12 +198,8 @@
228 198 if ( $global_user_id !== $this->utils( 'options' )->current_user_id() ) {
229 199 $global_user = $this->utils( 'options' )->get( 'user', false, $global_user_id );
230 200
231 201 if ( ! empty( $global_user ) ) {
232 - if ( is_array( $global_user ) ) {
233 - unset( $global_user['api_key'] );
234 - }
235 -
236 202 $global_user['meta'] = $this->user_meta();
237 203 }
238 204 }
239 205
@@ -247,13 +213,8 @@
247 213
248 214 $_user = ( new static )->utils( 'options' )->get( 'user', null );
249 215
250 216 if ( ! is_null( $_user ) ) {
251 - // Profiles stored before 3.7.1 may still carry the cloud API key.
252 - if ( is_array( $_user ) ) {
253 - unset( $_user['api_key'] );
254 - }
255 -
256 217 $_user['meta'] = self::get_instance()->user_meta();
257 218 }
258 219
259 220 if ( empty( $_user ) ) {