Z
Z
Zaur Ashurbekov2017-10-11 17:07:15
Ruby on Rails
Zaur Ashurbekov, 2017-10-11 17:07:15

Why doesn't devise authorize the admin in production?

Hello Toaster!
There is a blog with connected devis for the admin, like this:

class Admin < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable
end

there is a rake task to create an admin
namespace :deploy do
  desc "TODO"
  task init_admin: :environment do
        Admin.create(email: "[email protected]", password: "password")
  end
end

The task runs without errors, but when I want to authorize on the site, it simply reloads the authorization page. No error messages etc. Authorization pages are devis, not custom.
Here is what unicorn writes in the error log:
92.50.231.169 - - [11/Oct/2017:16:43:46 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1391
92.50.231.169 - - [11/Oct/2017:16:43:52 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1575
92.50.231.169 - - [11/Oct/2017:16:46:39 +0300] "GET /admins/sign_in HTTP/1.0" 200 - 0.0067
92.50.231.169 - - [11/Oct/2017:16:47:09 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1442
92.50.231.169 - - [11/Oct/2017:16:50:19 +0300] "GET / HTTP/1.0" 200 - 0.0086
92.50.231.169 - - [11/Oct/2017:16:51:04 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1475
43.241.229.205 - - [11/Oct/2017:16:51:17 +0300] "GET / HTTP/1.0" 200 - 0.0070
92.50.231.169 - - [11/Oct/2017:16:59:52 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1598
92.50.231.169 - - [11/Oct/2017:17:00:07 +0300] "GET /unauthenticated HTTP/1.0" 302 - 0.0099
92.50.231.169 - - [11/Oct/2017:17:00:08 +0300] "GET /admins/sign_in HTTP/1.0" 200 - 0.0100
92.50.231.169 - - [11/Oct/2017:17:00:17 +0300] "POST /admins/sign_in HTTP/1.0" 200 - 0.1422

What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Ponomarev, 2017-10-14
@ilyario

Is there a block for error output on the page?
The problem may simply be that the admin `[email protected]` has already been created with a different password. When you log in, you try to log in with the wrong password (according to the database version).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question