Commit c9e78ac1 authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

[WP] Changing url formation

Signed-off-by: Lucas Braz Cunha's avatarLucas Braz Cunha <lbc16@inf.ufpr.br>
parent 09c4ae86
module Api::V1
module Api::V1
class Accounts::PasswordsController < DeviseTokenAuth::PasswordsController
# this action is responsible for generating password reset tokens and
......@@ -11,12 +11,12 @@ module Api::V1
# fall back to default value if provided
@redirect_url ||= DeviseTokenAuth.default_password_reset_url
unless @redirect_url
return render_create_error_missing_redirect_url
end
@resource = Account.find_by(uid: params[:cpf])
@resource = Account.find_by(uid: params[:cpf])
if @resource.citizen.email.nil? or @resource.citizen.email.empty?
render json: {
errors: ["User #{params[:cpf]} does not have an email registered."]
......@@ -24,7 +24,7 @@ module Api::V1
return
end
@resource.email = @resource.citizen.email
@resource.email = @resource.citizen.email
@resource.save
@email = @resource.email
......@@ -75,7 +75,7 @@ module Api::V1
@resource.skip_confirmation! if @resource.devise_modules.include?(:confirmable) && !@resource.confirmed_at
# allow user to change password once without current_password
@resource.allow_password_change = true;
#@resource.allow_password_change = true;
@resource.save!
yield @resource if block_given?
......@@ -99,11 +99,15 @@ module Api::V1
def gen_url(url, params = {})
uri = URI(url)
res = "http://#{uri.path}"
puts 'uri'
puts uri.path
res = "#{uri}"
puts 'res'
puts res
query = [uri.query, params.to_query].reject(&:blank?).join('&')
res += "?#{query}"
res += "##{uri.fragment}" if uri.fragment
puts res
return res
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment