slack_import: Show validation error on empty slack access token.

We used to rely on browser to show error for empty slack access
token, but now we are using our own error element for this.
This commit is contained in:
Aman Agrawal
2025-05-20 13:35:58 +05:30
committed by Tim Abbott
parent 68372f8e03
commit 18b0681d26
2 changed files with 3 additions and 3 deletions

View File

@@ -41,7 +41,7 @@
<label for="slack_access_token" class="inline-block label-title">{{ _('Slack bot user OAuth token') }}</label>
<input id="slack-access-token" type="text"
placeholder="xoxb-…"
maxlength="100" name="slack_access_token" required {% if slack_access_token %} value="{{ slack_access_token }}" {% endif %} />
maxlength="100" name="slack_access_token" {% if slack_access_token %} value="{{ slack_access_token }}" {% endif %} />
{% if slack_access_token_validation_error %}
<p id="slack-access-token-validation-error" class="help-inline text-error">{{ slack_access_token_validation_error }}</p>
{% endif %}

View File

@@ -361,8 +361,8 @@ def registration_helper(
}
saved_slack_access_token = prereg_realm.data_import_metadata.get("slack_access_token")
if saved_slack_access_token or slack_access_token:
if slack_access_token and slack_access_token != saved_slack_access_token:
if saved_slack_access_token or slack_access_token is not None:
if slack_access_token is not None and slack_access_token != saved_slack_access_token:
# Verify slack token access.
from zerver.data_import.slack import (
SLACK_IMPORT_TOKEN_SCOPES,