| @@ -116,18 +116,23 @@ | ||
| 116 | 116 | 'user_id' => $userId |
| 117 | 117 | ]); |
| 118 | 118 | |
| 119 | 119 | $this->updateUser($processedData, $userId); |
| 120 | - $this->setUserLoggedIn($userId); | |
| 120 | + $storeSettings = new StoreSettings(); | |
| 121 | + $autoLogin = $storeSettings->get('auto_login_after_account_creation') === 'yes'; | |
| 122 | + if ($autoLogin) { | |
| 123 | + $this->setUserLoggedIn($userId); | |
| 124 | + } | |
| 121 | 125 | $this->sendEmail($userId); |
| 122 | 126 | |
| 127 | + $profilePage = $storeSettings->getCustomerProfilePage() . '#/profile'; | |
| 123 | 128 | |
| 124 | - $checkoutPage = (new StoreSettings())->getCustomerProfilePage() . '#/profile'; | |
| 125 | - | |
| 126 | 129 | return $this->sendSuccess([ |
| 127 | - 'message' => __('User created successfully! You are now logged in.', 'fluent-cart'), | |
| 130 | + 'message' => $autoLogin | |
| 131 | + ? __('User created successfully! You are now logged in.', 'fluent-cart') | |
| 132 | + : __('Your account has been created. Please check your email to set your password and log in.', 'fluent-cart'), | |
| 128 | 133 | 'code' => 'user_created', |
| 129 | - 'redirect_url' => $checkoutPage | |
| 134 | + 'redirect_url' => $autoLogin ? $profilePage : wp_login_url($profilePage) | |
| 130 | 135 | ]); |
| 131 | 136 | } |
| 132 | 137 | |
| 133 | 138 | protected function sendEmail($userId) |