ng-token-auth
ng-token-auth copied to clipboard
Reset password link not removed
Hello,
When I come from the reset password link, params are not removes from url, so they stay for future navigation.
I use ui-router.
Thx
Could you please show some examples to better illustrate this?
do you have adress like: mydomain.com/#/state?param1=
or mydomain.com/?param1=/#/state
?
It is propably backend issue. Like @bslipek said you need to have url likie mydomain.com/#/state?param1=....
.
If you are using devise token auth.
You have to override your User model and change add there method
def build_auth_url(base_url, args)
args[:uid] = uid
args[:expiry] = tokens[args[:client_id]]['expiry']
YourCustom::SreviceToGenerateUrl.generate_url(base_url, args)
end
You need to override method from https://github.com/lynndylanhurley/devise_token_auth/blob/master/lib/devise_token_auth/url.rb. This method set wrong order of params. It is my custom implementation. Hope this help.
# frozen_string_literal: true
module UserManagement
# It is response for create reset url
class ResetPassword
# it modify method from https://github.com/lynndylanhurley/devise_token_auth/blob/master/lib/devise_token_auth/url.rb
# it generate url like http://localhost/#/xxx?param=1 instead http://localhost/?param=1/#/xxx
def self.generate_url(url, params = {})
uri = URI(url)
url = scheme_and_host(uri) + port_if_not_default(uri) + path(uri) + fragment(uri)
query = [uri.query, params.to_query].reject(&:blank?).join('&')
url + "?#{query}"
end
private_class_method
def self.scheme_and_host(uri)
"#{uri.scheme}://#{uri.host}"
end
def self.port_if_not_default(uri)
(uri.port != 80 && uri.port != 443) ? ":#{uri.port}" : ''
end
def self.path(uri)
uri.path ? uri.path : ''
end
def self.fragment(uri)
uri.fragment ? "##{uri.fragment}" : ''
end
end
end