Fix bug: User cannot connect using the orbit button (Devise configuration)
This commit is contained in:
parent
2c5539eda9
commit
9b5f4e4775
|
@ -1,26 +0,0 @@
|
||||||
class SessionsController < Devise::SessionsController
|
|
||||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
|
||||||
include Devise::Controllers::InternalHelpers
|
|
||||||
|
|
||||||
# POST /resource/sign_in
|
|
||||||
def create
|
|
||||||
# login_password = params[:user][:password]
|
|
||||||
# login_uid = params[:user][:nccu_ldap_uid]
|
|
||||||
login_password = params[:user][:password]
|
|
||||||
login_email = params[:user][:email]
|
|
||||||
result = false
|
|
||||||
resource = User.first(conditions:{ email: login_email })
|
|
||||||
set_flash_message(:notice, :signed_in) if is_navigational_format?
|
|
||||||
if resource.nil?
|
|
||||||
logger.error "Can't find user #{login_email}"
|
|
||||||
flash[:notice] = t('devise.failure.invalid')
|
|
||||||
render :action => "new"
|
|
||||||
else
|
|
||||||
logger.info "=== passed"
|
|
||||||
resource_name = resource.class.to_s.downcase
|
|
||||||
sign_in(resource_name, resource)
|
|
||||||
respond_with resource, :location => redirect_location(resource_name, resource)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -9,10 +9,7 @@ class User
|
||||||
|
|
||||||
field :admin, :type => Boolean, :default => true
|
field :admin, :type => Boolean, :default => true
|
||||||
field :active_role
|
field :active_role
|
||||||
field :nccu_ldap_uid
|
|
||||||
field :email
|
field :email
|
||||||
# field :cache_dept
|
|
||||||
# has_one :cache_dept, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
field :cache_dept,type: Hash
|
field :cache_dept,type: Hash
|
||||||
field :status_record,type: Hash
|
field :status_record,type: Hash
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
<h3><%= t(:login) %></h3>
|
<h3><%= t(:login) %></h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="container" class="sign-in">
|
<div id="container" class="sign-in">
|
||||||
<%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %>
|
<%= form_for resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'user_new form-horizontal'} do |f| %>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<% flash.each do |key, msg| %>
|
<% flash.each do |key, msg| %>
|
||||||
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
|
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
|
||||||
<% end%>
|
<% end %>
|
||||||
<p class="alert hide">You need to sign in or sign up before continuing.</p>
|
<p class="alert hide">You need to sign in or sign up before continuing.</p>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="control-group clear">
|
<div class="control-group clear">
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
<li>
|
<li>
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<span class="add-on"><i class="icon-user"></i></span>
|
<span class="add-on"><i class="icon-user"></i></span>
|
||||||
<%= f.text_field :nccu_ldap_uid, :class => 'span2', :placeholder => t('nccu_c.nccu_ldap_uid'), :size => 16 %>
|
<%= f.text_field :email, :class => 'span2', :placeholder => t(:email), :size => 16 %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -21,7 +21,7 @@ Devise.setup do |config|
|
||||||
# parameters are used only when authenticating and not when retrieving from
|
# parameters are used only when authenticating and not when retrieving from
|
||||||
# session. If you need permissions, you should implement that in a before filter.
|
# session. If you need permissions, you should implement that in a before filter.
|
||||||
# config.authentication_keys = [ :email ]
|
# config.authentication_keys = [ :email ]
|
||||||
config.authentication_keys = [ :nccu_ldap_uid ]
|
config.authentication_keys = [ :email ]
|
||||||
|
|
||||||
|
|
||||||
# Tell if authentication through request.params is enabled. True by default.
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Orbit::Application.routes.draw do
|
Orbit::Application.routes.draw do
|
||||||
|
|
||||||
devise_for :users,:controllers => {:sessions => 'sessions'}
|
devise_for :users
|
||||||
mount Resque::Server, :at => "/admin/resque"
|
mount Resque::Server, :at => "/admin/resque"
|
||||||
|
|
||||||
# routes for sinatra app
|
# routes for sinatra app
|
||||||
|
|
Reference in New Issue