Class: EducodeSales::SessionsController
Instance Method Summary
collapse
#authenticate_admin, #authenticate_request, #current_user, #filter, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url
#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
#create ⇒ Object
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
|
#login ⇒ Object
9
10
|
# File 'app/controllers/educode_sales/sessions_controller.rb', line 9
def login
end
|
#logout ⇒ Object
29
30
31
32
|
# File 'app/controllers/educode_sales/sessions_controller.rb', line 29
def logout
session[:admin_id] = nil
redirect_to login_path
end
|