Enhancement: Reduce shown messages after password reset/verify to one single version.
This commit is contained in:
parent
bca16dee16
commit
e61fa6795e
4 changed files with 20 additions and 25 deletions
|
@ -58,22 +58,13 @@ class Index extends App.ControllerContent
|
||||||
)
|
)
|
||||||
|
|
||||||
success: (data) =>
|
success: (data) =>
|
||||||
if data.message is 'ok'
|
|
||||||
|
|
||||||
# if in developer mode, redirect to set new password
|
# if in developer mode, redirect to set new password
|
||||||
if data.token && @Config.get('developer_mode') is true
|
if data.token && @Config.get('developer_mode') is true
|
||||||
redirect = =>
|
redirect = =>
|
||||||
@navigate "#password_reset_verify/#{data.token}"
|
@navigate "#password_reset_verify/#{data.token}"
|
||||||
@delay(redirect, 2000)
|
@delay(redirect, 2000)
|
||||||
@render(sent: true)
|
@render(sent: true)
|
||||||
|
|
||||||
else
|
|
||||||
@$('[name=username]').val('')
|
|
||||||
@notify(
|
|
||||||
type: 'error'
|
|
||||||
msg: App.i18n.translateContent('Username or email address invalid, please try again.')
|
|
||||||
)
|
|
||||||
@formEnable( @el.find('.form-password') )
|
|
||||||
|
|
||||||
App.Config.set('password_reset', Index, 'Routes')
|
App.Config.set('password_reset', Index, 'Routes')
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
<% if @sent: %>
|
<% if @sent: %>
|
||||||
<h2><%- @T('We\'ve sent password reset instructions to your email address.') %><small></small></h2>
|
<h2><%- @T('We\'ve sent password reset instructions to your email address.') %><small></small></h2>
|
||||||
<p><%- @T('If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try resending your request.') %></p>
|
<p><%- @T('If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try resending your request.') %></p>
|
||||||
<a href="#" class="subtle retry">» <%- @T('again') %> «</a>
|
<div class="form-controls">
|
||||||
|
<a class="btn btn--text btn--subtle js-cancel" href="#login"><%- @T( 'Cancel & Go Back' ) %></a>
|
||||||
|
<button class="btn btn--primary retry align-right"><%- @T( 'again' ) %></button>
|
||||||
|
</div>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<h2><%- @T( 'Forgot your password?' ) %><small></small></h2>
|
<h2><%- @T( 'Forgot your password?' ) %><small></small></h2>
|
||||||
<form class="form-password">
|
<form class="form-password">
|
||||||
|
|
|
@ -534,9 +534,12 @@ curl http://localhost/api/v1/users/email_verify_send -v -u #{login}:#{password}
|
||||||
|
|
||||||
raise Exceptions::UnprocessableEntity, 'No email!' if !params[:email]
|
raise Exceptions::UnprocessableEntity, 'No email!' if !params[:email]
|
||||||
|
|
||||||
# check is verify is possible to send
|
|
||||||
user = User.find_by(email: params[:email].downcase)
|
user = User.find_by(email: params[:email].downcase)
|
||||||
raise Exceptions::UnprocessableEntity, 'No such user!' if !user
|
if !user
|
||||||
|
# result is always positive to avoid leaking of existing user accounts
|
||||||
|
render json: { message: 'ok' }, status: :ok
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
#if user.verified == true
|
#if user.verified == true
|
||||||
# render json: { error: 'Already verified!' }, status: :unprocessable_entity
|
# render json: { error: 'Already verified!' }, status: :unprocessable_entity
|
||||||
|
@ -615,14 +618,10 @@ curl http://localhost/api/v1/users/password_reset -v -u #{login}:#{password} -H
|
||||||
render json: { message: 'ok', token: result[:token].name }, status: :ok
|
render json: { message: 'ok', token: result[:token].name }, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# token sent to user, send ok to browser
|
|
||||||
render json: { message: 'ok' }, status: :ok
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# unable to generate token
|
# result is always positive to avoid leaking of existing user accounts
|
||||||
render json: { message: 'failed' }, status: :ok
|
render json: { message: 'ok' }, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -208,9 +208,11 @@ class SignupPasswordChangeAndResetTest < TestCase
|
||||||
click(css: '.content .btn--primary')
|
click(css: '.content .btn--primary')
|
||||||
watch_for(
|
watch_for(
|
||||||
css: 'body',
|
css: 'body',
|
||||||
value: 'address invalid',
|
value: 'sent password reset instructions',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
click(css: '.content .btn--primary')
|
||||||
|
|
||||||
set(
|
set(
|
||||||
css: 'input[name="username"]',
|
css: 'input[name="username"]',
|
||||||
value: signup_user_email,
|
value: signup_user_email,
|
||||||
|
|
Loading…
Reference in a new issue