Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication 我能';t在设备会话中注册多个用户_Authentication_Devise_Ruby On Rails 6 - Fatal编程技术网

Authentication 我能';t在设备会话中注册多个用户

Authentication 我能';t在设备会话中注册多个用户,authentication,devise,ruby-on-rails-6,Authentication,Devise,Ruby On Rails 6,我正在使用设备对管理员和用户进行身份验证。 管理员可以注册用户,但是,每当管理员想要注册多个用户时,管理员必须为他想要注册的任何用户销毁并创建他的管理会话。i、 例如,管理会话只允许注册一个用户 这是一个成功的用户(alunos)注册后,管理员登录权 Started POST "/alunos" for ::1 at 2019-09-30 10:39:29 -0300 Processing by Alunos::RegistrationsController#create as HTML P

我正在使用设备对管理员和用户进行身份验证。 管理员可以注册用户,但是,每当管理员想要注册多个用户时,管理员必须为他想要注册的任何用户销毁并创建他的管理会话。i、 例如,管理会话只允许注册一个用户

这是一个成功的用户(alunos)注册后,管理员登录权

Started POST "/alunos" for ::1 at 2019-09-30 10:39:29 -0300
Processing by Alunos::RegistrationsController#create as HTML
  Parameters: {"authenticity_token"=>"WBl6StcQuSl+v/rCuvm/xUPp6u/Cpz137gHunvUtE1yWUXkwoCu5AvXYfKX1PfxhNoV3JtzluHK9P+uHb+LDyw==", "x"=>"31", "y"=>"25", "aluno"=>{"matricula"=>"M1", "nome"=>"AA", "rg"=>"11", "cpf"=>"11", "nascimento"=>"2001-01-01", "sexo"=>"Masculino", "estadocivil"=>"solteiro", "telefone"=>"11", "email"=>"test1@test", "cidade"=>"AA", "rua"=>"AA", "numero"=>"11", "bairro"=>"AA", "complemento"=>"AA", "estado"=>"AA", "pais"=>"AA", "cep"=>"AA", "naturalidade"=>"AA", "ingresso"=>"11", "turma"=>"AA", "conjuge"=>"AA", "mae"=>"AA", "pai"=>"AA", "igreja_id"=>"1", "residenocampus"=>"1", "password"=>"[FILTERED]"}}
   (0.2ms)  BEGIN
  Aluno Exists? (0.3ms)  SELECT 1 AS one FROM `alunos` WHERE `alunos`.`email` = BINARY 'test1@test' LIMIT 1
  Aluno Create (0.3ms)  INSERT INTO `alunos` (`matricula`, `nome`, `rg`, `cpf`, `telefone`, `email`, `sexo`, `ingresso`, `turma`, `nascimento`, `cidade`, `igreja_id`, `estado`, `rua`, `bairro`, `complemento`, `cep`, `numero`, `pais`, `created_at`, `updated_at`, `naturalidade`, `estadocivil`, `residenocampus`, `conjuge`, `mae`, `pai`, `encrypted_password`) VALUES ('M1', 'AA', '11', '11', '11', 'test1@test', 'Masculino', 11, 'AA', '2001-01-01', 'AA', 1, 'AA', 'AA', 'AA', 'AA', 'AA', 11, 'AA', '2019-09-30 13:39:29.269375', '2019-09-30 13:39:29.269375', 'AA', 'solteiro', TRUE, 'AA', 'AA', 'AA', '$2a$11$jh1UODTYW40mnf2Tc.rJ/ubDhZWc3nH/qfc1CJeAOijDYccEBhXIy')
   (3.6ms)  COMMIT

在第一次注册之后有一个未成功的注册

Started POST "/alunos" for ::1 at 2019-09-30 10:40:17 -0300
Processing by Alunos::RegistrationsController#create as HTML
  Parameters: {"authenticity_token"=>"0HM5IujlLKwLOVdfVEMi6zoYM2WDCNS3SWOZnLncnkkeOzpYn94sh4Be0Tgbh2FPT3SurJ1KUbIaXZyFIxNO3g==", "x"=>"16", "y"=>"19", "aluno"=>{"matricula"=>"BB", "nome"=>"BB", "rg"=>"22", "cpf"=>"22", "nascimento"=>"2001-01-02", "sexo"=>"Feminino", "estadocivil"=>"casado", "telefone"=>"22", "email"=>"test2@test", "cidade"=>"BB", "rua"=>"BB", "numero"=>"22", "bairro"=>"BB", "complemento"=>"BB", "estado"=>"BB", "pais"=>"BB", "cep"=>"BB", "naturalidade"=>"BB", "ingresso"=>"22", "turma"=>"BB", "conjuge"=>"BB", "mae"=>"BB", "pai"=>"BB", "igreja_id"=>"2", "residenocampus"=>"1", "password"=>"[FILTERED]"}}
  Aluno Load (0.8ms)  SELECT `alunos`.* FROM `alunos` WHERE `alunos`.`id` = 9 ORDER BY `alunos`.`id` ASC LIMIT 1
Redirected to http://localhost:3000/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 7ms (ActiveRecord: 0.8ms | Allocations: 1819)
我意识到错误“过滤器链因需要而停止\u无\u身份验证呈现或重定向”就是原因


有人能帮我解决这个问题吗?

好的,解决起来很简单

如果有人有相同的问题,我只会阻止Desive尝试登录刚注册的用户:

class Alunos::RegistrationsController < Devise::RegistrationsController

  def create
      super 
    end

    protected

    def sign_up(resource_name, resource)
      true
    end
end
class Alunos::RegistrationController