using authentication for app

This commit is contained in:
2012-10-25 16:11:49 +02:00
parent 5479d3760b
commit 28ec047f1d
14 changed files with 429 additions and 40 deletions
@@ -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"
+10
View File
@@ -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