Minor bug fixes
This commit is contained in:
parent
16ce3b6324
commit
3e23dad5c5
3 changed files with 18 additions and 4 deletions
|
|
@ -183,13 +183,22 @@ public function createPlatformAccount(): void
|
|||
|
||||
$this->nextStep();
|
||||
} catch (\App\Exceptions\PlatformAuthException $e) {
|
||||
if (str_contains($e->getMessage(), 'Rate limited by')) {
|
||||
$this->formErrors['general'] = $e->getMessage();
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Rate limited by')) {
|
||||
$this->formErrors['general'] = $message;
|
||||
} elseif (str_contains($message, 'Connection failed')) {
|
||||
$this->formErrors['general'] = 'Unable to connect to the Lemmy instance. Please check the URL and try again.';
|
||||
} else {
|
||||
$this->formErrors['general'] = 'Invalid username or password. Please check your credentials and try again.';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->formErrors['general'] = 'Unable to connect to the Lemmy instance. Please check the URL and try again.';
|
||||
logger()->error('Lemmy platform account creation failed', [
|
||||
'instance_url' => $fullInstanceUrl,
|
||||
'username' => $this->username,
|
||||
'error' => $e->getMessage(),
|
||||
'class' => get_class($e),
|
||||
]);
|
||||
$this->formErrors['general'] = 'An error occurred while setting up your account. Please try again.';
|
||||
} finally {
|
||||
$this->isLoading = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ public function login(string $username, string $password): ?string
|
|||
$data = $response->json();
|
||||
return $data['jwt'] ?? null;
|
||||
} catch (Exception $e) {
|
||||
// Re-throw rate limit exceptions immediately
|
||||
if (str_contains($e->getMessage(), 'Rate limited')) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
logger()->error('Lemmy login exception', ['error' => $e->getMessage(), 'scheme' => $scheme]);
|
||||
// If this was the first attempt and HTTPS, try HTTP next
|
||||
if ($idx === 0 && in_array('http', $schemesToTry, true)) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public function up(): void
|
|||
$table->enum('platform', ['lemmy']);
|
||||
$table->string('instance_url');
|
||||
$table->string('username');
|
||||
$table->string('password');
|
||||
$table->text('password');
|
||||
$table->json('settings')->nullable();
|
||||
$table->boolean('is_active')->default(false);
|
||||
$table->timestamp('last_tested_at')->nullable();
|
||||
|
|
|
|||
Loading…
Reference in a new issue