当用户注册时,我试图在我的rails应用程序中使用Devise Gem进行身份验证。但是当我到我的rails控制台检查用户表时,它没有在数据库中创建新用户。我试图用我的注册控制器来覆盖设计注册控制器,但是没有成功。注册控制器似乎没有设置create方法以便可以在数据库中创建它。谁能提供任何帮助,告诉我哪里出错了?
用户注册后,服务器日志中会显示什么:
开始获取“/用户/注册?utf8=
注册页面new.html.erb:
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<title>Sign Up</title>
</head>
<body class="signup-page access-page has-full-screen-bg">
<div class="upper-wrapper">
<!-- Header -->
<!-- ******Signup Section****** -->
<section class="signup-section access-section section">
<div class="container">
<div class="row">
<div class="form-box col-md-8 col-sm-12 col-xs-12 col- md-offset-2 col-sm-offset-0 xs-offset-0">
<div class="form-box-inner">
<h2 class="title text-center">Sign up now</h2>
<p class="intro text-center">It only takes 3 minutes!</p>
<div class="row">
<div class="form-container col-md-5 col-sm-12 col-xs-12">
<form class="signup-form">
<%= form_for(resource, as: resource_name, url: user_registration_path(resource_name)) do |f| %> <%= devise_error_messages! %>
<div class="form-group email">
<!-- <label class="sr-only" for="signup-email">Your email</label>
<input id="signup-email" type="email" class="form-control login-email" placeholder="Your email"> -->
<%= f.label :email, class: 'sr-only' %>
<%= f.text_field :email, class: 'form-control login-email', placeholder: "Your email" %>
</div><!--//form-group-->
<div class="form-group password">
<%= f.label :password, class: 'sr-only' %>
<%= f.text_field :password, class: 'form-control login-password', placeholder: "Your password" %>
</div>
<!--//form-group-->
<div class="col-md-12 col-sm-12 col-xs-12 form-group">
<%= f.submit "Sign up", class: 'btn btn-block btn-cta-primary' %>
</div>
<p class="note">By signing up, you agree to our terms of services and privacy policy.</p>
<p class="lead">Already have an account? <%= link_to "Log in", user_session_path, class: "login-link" %>
</p>
<% end %>
</form>
</div><!--//form-container-->
<div class="social-btns col-md-5 col-sm-12 col-xs-12 col-md-offset-1 col-sm-offset-0 col-sm-offset-0">
<div class="divider"><span>Or</span></div>
<ul class="list-unstyled social-login">
<li><button class="twitter-btn btn" type="button"><i class="fa fa-twitter"></i>Sign up with Twitter</button></li>
<li><button class="facebook-btn btn" type="button"><i class="fa fa-facebook"></i>Sign up with Facebook</button></li>
<li><button class="github-btn btn" type="button"><i class="fa fa-github-alt"></i>Sign up with Github</button></li>
<li><button class="google-btn btn" type="button"><i class="fa fa-google-plus"></i>Sign up with Google</button></li>
</ul>
<p class="note">Don't worry, we won't post anything without your permission.</p>
</div><!--//social-login-->
</div><!--//row-->
</div><!--//form-box-inner-->
</div><!--//form-box-->
</div><!--//row-->
</div><!--//container-->
</section><!--//signup-section-->
</div><!--//upper-wrapper-->
<!--FOOTER -->
<!-- Javascript -->
<script>
/* ======= Fixed header when scrolled ======= */
$(window).on('scroll load', function()
{
if ($(window).scrollTop() > 0)
{
$('#header').removeClass('scrolled');
}
else
{
$('#header').addClass('scrolled');
}
});
</script>
设计注册控制器路线:
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
尝试覆盖设计注册控制器:
class SignupController::RegistrationsController < Devise::RegistrationsController
def new
#@user = User.new
@resource_name = User.new
end
def create
@resource_name = User.new(user_params)
#if @user.save
if @resource_name.save
flash[:notice] = "Your user account has been created!"
create_session(@resource_name)
redirect_to '/'
else
flash[:error] = "Your user account was not created, please try again."
render :new
end
end
def user_params
params.require(:user, :email)
end
end
目前,在另一种形式中有一种形式:
<form class="signup-form">
<%= form_for... %>
但是,无法嵌套表单。外部表单被提交,并被提交到当前页面 URL。
您需要删除外部表单并将Signup-form
类添加到form_for
:
<%= form_for(resource, as: resource_name, url: user_registration_path(resource_name), html: {class: 'signup-form'}) do |f| %>
我对oracle数据库非常陌生,请原谅我在问题中的任何技术错误。我使用的是oracle 19c,我认为我的“system”用户密码与“sysdba”用户密码不同。在安装时,我每次都使用相同的密码,但现在连接到system或“\as sysdba”时,连接没有问题,但当我键入“orcl_listener”或“orcl”或“sysdba”的密码时,密码是错误的。例如:conn sysdba输入密码:错
新增ISV有两种方式 方式1 启动sop-admin,在admin后台ISV管理添加 方式2 启动sop-website-server,用户访问自主注册
接口说明 注册用户 如需调用,请访问 开发者文档 来查看详细的接口使用说明 该接口仅开放给已获取SDK的开发者 API地址 POST /usercenter/api/register/v1.0.0/registerUser 是否需要登录 否 请求字段说明 参数 类型 请求类型 是否必须 说明 loginName string formData 是 用户登录 mobile string formDa
接口说明 注册用户 如需调用,请访问 开发者文档 来查看详细的接口使用说明 该接口仅开放给已获取SDK的开发者 如开启https功能,请求地址的协议应改为https,如:https://www.example.com/wish3dearth/api/access/v1.0.0/getLicenseInfo API地址 POST /usercenter/api/register/v1.0.0/reg
我试图使用Cognito用户池控制台创建一个用户(我正在设置用户名和临时密码的值),但我一直收到这个错误。 属性不符合架构:生日:数字不能超过10个字符(服务:AWSCognitoIdentityProviderService;状态代码:400;错误代码:InvalidParameterException;请求ID:98f3de9e-5ce3-11e7-98e8-9d0c69d31df9) 使用无
我试图为我的网络应用程序建立一个登录系统,但我无法让Passport工作。该应用程序是作为REST API构建的,因此用户应该能够使用电子邮件和密码注册,之后他们应该能够使用这些凭据登录(所以我认为他们需要在登录凭据时从Passport接收访问令牌是正确的)。 我想我可以只向“注册”路径发送一个JSON帖子来注册一个新用户,然后向“登录”路径发送一个帖子来将访问令牌返回到客户端,但据我所知,没有这