Move authentication into users controller
This commit is contained in:
parent
4f0fe7d428
commit
fe45f4eaa3
|
@ -11,25 +11,4 @@ class MainController < ApplicationController
|
|||
@hydrants = Hydrant.find_closest(@lat, @lng)
|
||||
end
|
||||
end
|
||||
|
||||
def sign_up
|
||||
@data = {"email" => params[:email], "name" => params[:name]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
|
||||
def sign_in
|
||||
@data = {"email" => params[:email]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
|
||||
def forgot_password
|
||||
@data = {"email" => params[:email]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
class UsersController < ApplicationController
|
||||
def sign_up
|
||||
@data = {"email" => params[:email], "name" => params[:name]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
|
||||
def sign_in
|
||||
@data = {"email" => params[:email]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
|
||||
def forgot_password
|
||||
@data = {"email" => params[:email]}
|
||||
respond_to do |format|
|
||||
format.json{render :json => @data}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module UsersHelper
|
||||
end
|
|
@ -1,7 +1,6 @@
|
|||
AdoptAHydrant::Application.routes.draw do
|
||||
get "/javascripts/:action" => "javascripts#action"
|
||||
post "/sign_up.:format" => "main#sign_up"
|
||||
post "/sign_in.:format" => "main#sign_in"
|
||||
post "/forgot_password.:format" => "main#forgot_password"
|
||||
post "/sign_up.:format" => "users#sign_up", :as => "sign_up"
|
||||
post "/sign_in.:format" => "users#sign_in", :as => "sign_in"
|
||||
post "/forgot_password.:format" => "users#forgot_password", :as => "forgot_password"
|
||||
root :to => "main#index"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UsersHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in New Issue