back-end/app/controllers/admin_user_controller.rb
# Reset user password from link sent to email
Reset user password from link sent to email
Reset user password from link sent to email
def reset_password
    if params[:access_token] && params[:secret_key] && params[:password]
      user_link = PasswordResetLink.where(access_token: params[:access_token],
                                          secret_key: params[:secret_key]).first
      if user_link
        user = AdminUser.find(user_link.user_id)
        user.password = params[:password]
        if user.save
          render json: {status: "success", message: "password changed"}
        else
          error_message = user.errors.full_messages
        end
      else
        error_message = "User not found"
      end
    else
      error_message = "Invalid Parameters"
    end
    render json: {status: "error", error_message: error_message}
  end
def reset_password if params [ :access_token ] && params [ :secret_key ] && params [ :password ] user_link = PasswordResetLink . where ( access_token : params [ :access_token ] , secret_key : params [ :secret_key ] ) . first if user_link user = AdminUser . find ( user_link . user_id ) user . password = params [ :password ] if user . save render json : { status : "success" , message : "password changed" } else error_message = user . errors . full_messages end else error_message = "User not found" end else error_message = "Invalid Parameters" end render json : { status : "error" , error_message : error_message } end
Reset user password from link sent to email
Reset user password from link sent to email