mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: 2FA prompt incorrectly displayed on admin login page.
This commit is contained in:
parent
3637f0d3bb
commit
1f74509a75
@ -7,10 +7,12 @@
|
||||
<%= @message %>
|
||||
<% if @error %><p><%= @error %></p><% end %>
|
||||
|
||||
<%=form_tag({}, method: :put) do %>
|
||||
<%= label_tag(:second_factor_token, t('login.second_factor_description')) %>
|
||||
<%= text_field_tag(:second_factor_token, nil, autofocus: true) %><br><br>
|
||||
<%= submit_tag t('submit')%>
|
||||
<% if @second_factor_required %>
|
||||
<%=form_tag({}, method: :put) do %>
|
||||
<%= label_tag(:second_factor_token, t('login.second_factor_description')) %>
|
||||
<%= text_field_tag(:second_factor_token, nil, autofocus: true) %><br><br>
|
||||
<%= submit_tag t('submit')%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%=form_tag({}, method: :put) do %>
|
||||
|
@ -523,6 +523,21 @@ describe UsersController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when email is incorrect' do
|
||||
render_views
|
||||
|
||||
it 'should return the right response' do
|
||||
get :admin_login, params: { email: 'random' }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
response_body = response.body
|
||||
|
||||
expect(response_body).to match(I18n.t("admin_login.errors.unknown_email_address"))
|
||||
expect(response_body).to_not match(I18n.t("login.second_factor_description"))
|
||||
end
|
||||
end
|
||||
|
||||
context 'logs in admin' do
|
||||
it 'does not log in admin with invalid token' do
|
||||
SiteSetting.sso_url = "https://www.example.com/sso"
|
||||
|
Loading…
Reference in New Issue
Block a user