Verify
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
class Api::AuthenticateController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
before_action :find_shop
|
||||
|
||||
def create
|
||||
emp_id = params[:emp_id]
|
||||
password = params[:password]
|
||||
|
||||
if emp_id && password
|
||||
@employee = Employee.login(emp_id, password)
|
||||
@employee = Employee.login(@shop, emp_id, password)
|
||||
if @employee && @employee.role == "waiter"
|
||||
render json: JSON.generate({:status => true, :session_token => @employee.token_session, :name => @employee.name, :role => @employee.role})
|
||||
else
|
||||
@@ -65,4 +66,9 @@ class Api::AuthenticateController < Api::ApiController
|
||||
def authenticate_params
|
||||
params.permit(:emp_id, :password, :session_token)
|
||||
end
|
||||
|
||||
private
|
||||
def find_shop
|
||||
@shop = Shop.find_by_shop_code(params[:shop_code])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ module LoginVerification
|
||||
|
||||
def current_shop
|
||||
begin
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop =Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
rescue
|
||||
@@ -42,7 +42,7 @@ module LoginVerification
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop = Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
if @result && @cus
|
||||
json.status true
|
||||
json.customer_id @cus.customer_id
|
||||
json.message "Pin code verification succeeded"
|
||||
else
|
||||
json.status false
|
||||
|
||||
Reference in New Issue
Block a user