using authentication for app
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
before_filter :set_locale
|
||||
layout :layout_by_resource
|
||||
|
||||
|
||||
@@ -6,6 +7,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def set_locale
|
||||
I18n.locale = :nl
|
||||
end
|
||||
|
||||
def layout_by_resource
|
||||
if devise_controller?
|
||||
"phone"
|
||||
|
||||
@@ -2,6 +2,15 @@ class UserController < ApplicationController
|
||||
before_filter :allow_mobile, :authenticate_user!
|
||||
layout 'phone'
|
||||
|
||||
def authenticate_user_wrapper!
|
||||
authenticate_user! unless request.format.html?
|
||||
authenticate_user! if params[:action] == 'obtain_token'
|
||||
end
|
||||
|
||||
def obtain_token
|
||||
|
||||
end
|
||||
|
||||
alias :list :active_list
|
||||
|
||||
def allow_mobile
|
||||
@@ -153,6 +162,7 @@ class UserController < ApplicationController
|
||||
redirect_to(root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present?
|
||||
end
|
||||
format.json do
|
||||
render json: js_alert(t('messages.the_list_has_been_closed')) and return unless list.present?
|
||||
render json: list.with_orders_and_join_requests_as_json.merge(supplier_name: list.supplier.name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user