我正在使用公寓和设计 gem来进行多租户和身份验证。
我在根域网址(//....
setSupportActionBar(toolbar);
setToolbarIcon();
//...
private void setToolbarIcon() {
Drawable logo = getResources().getDrawable(R.drawable.app_logo);
if (toolbar != null) {
toolbar.setLogo(logo);
toolbar.setTitle(null);
}}
)中有一个sign_up
页面,我从中获取了用户的子域详细信息。
成功保存记录并重定向到新子域(example.com
)后,我需要sign_in
用户。
公寓架构:
帐户=>所有模式的通用(公共)
用户=>为每个模式单独创建(私有)
这个RegistrationController :
sub.example.com
以上代码成功重定向到新的子域,但是,虽然我在重定向之前在用户中签名,但它并没有在用户中签名。
任何人都可以帮助我将用户重定向为class Users::RegistrationsController < Devise::RegistrationsController
...
...
def create
ActiveRecord::Base.transaction do
@account = Account.new(account_params)
if @account.valid?
# Create & switch to the new tenant
Apartment::Tenant.create(@account.subdomain)
Apartment::Tenant.switch!(@account.subdomain)
@account.save
sign_in(:user, @account.user)
redirect_to root_url(subdomain: "#{Apartment::Tenant.current}")
else
render :action => 'new'
end
end
end
...
...
protected
def account_params
params.require(:account).permit(:name, :subdomain, user_attributes: [:first_name, :last_name, :email, :password, :password_confirmation])
end
end
到新的子域。
谢谢..
答案 0 :(得分:0)
最后,通过在:domain => :all
:domain => 'example.com'
中添加session_store
或rootdomain config.session_store :cookie_store, :key => '_domain_session', :domain => :all
选项解决了这个问题。
<强>配置/初始化/ session_store.rb 强>
config.session_store :cookie_store, :key => '_domain_session', :domain => 'example.com'
(或)
#!/bin/bash
host='ftp.xxxx.com'
USER='xxxx'
PASSWD='xxxx'
ftp -n -v $host << EOF
ascii
user $USER $PASSWD
prompt
mls /TEST/file.txt test.txt
quit
EOF
if [[ $? -eq 0 ]]
then
echo "The File file.txt Exists";
else
echo "The File file.txt dons not Exist";
fi