Class: EducodeSales::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/educode_sales/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin, #authenticate_request, #current_user, #filter, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url

Methods included from ApplicationHelper

#add_businesses_score, #base_url, #collection_amount_score, #completion_rate, #current?, #disk_filename, #get_businesses_chart, #handled_data, #handled_time_data, #handled_time_data_accurate, #relative_path, #signed_amount_score, #storage_path, #url_to_avatar, #visits_score

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/educode_sales/sessions_controller.rb', line 12

def create
  user = User.where("login = :acount OR mail = :acount OR phone = :acount", acount: params[:account]).first
  if user&.admin
    check_pwd(user)
  elsif user
    staff = Staff.find_by(user_id: user.id)
    if staff
      return render_failure('该账号已禁止使用') if staff.expired_at < Time.now
      check_pwd(user, staff)
    else
      render_failure('账号不存在')
    end
  else
    render_failure('账号或密码错误')
  end
end

#loginObject



9
10
# File 'app/controllers/educode_sales/sessions_controller.rb', line 9

def 
end

#logoutObject



29
30
31
32
# File 'app/controllers/educode_sales/sessions_controller.rb', line 29

def logout
  session[:admin_id] = nil
  redirect_to 
end