简体   繁体   English

从Wordpress页面登录Drupal网站

[英]Drupal Site login from wordpress page

I am trying to logged in to drupal site from wordpress using ajax. 我正在尝试使用Ajax从wordpress登录到drupal网站。 Scenario is like below: 场景如下:

I have 2 sites one is wordpress and one is in drupal. 我有2个站点,一个是wordpress,一个是drupal。 Right now half of the functionality is in drupal and I am switching to wordpress. 现在,一半的功能在drupal中,我正在切换到wordpress。 But now User needs to be logged in drupal site from wordpress page. 但是现在,用户需要从wordpress页面登录drupal网站。 I already set all the pages in wordpress if user is logged in drupal. 如果用户登录了drupal,我已经在wordpress中设置了所有页面。 BUt issue I am getting to make users logged in to drupal from the wordpress page. BUt问题我正在使用户从wordpress页面登录到drupal。 But I did: I created the sign in page in drupal and set the email & password from get request and auto submitted the page on loading. 但是我做到了:我在drupal中创建了登录页面,并从获取请求中设置了电子邮件和密码,并在加载时自动提交了页面。 It is working fine if I opened this page in broser So I am calling this page from wordpress page using ajax. 如果我在broser中打开此页面,则工作正常,因此我正在使用ajax从wordpress页面调用此页面。 I got 200 response from ajax call but user is not logged in drupal. 我收到来自ajax调用的200响应,但用户未登录drupal。

Here is the login form from your page 这是您页面的登录表单

<form action="http://www.seniorsearch.com/content/sign" class="webform-client-form" id="signin">
                            <div id="webform-component-name">
                                <input type="hidden" value="0" id="fb_login_id" name="submitted[fb_login_id]">
                                <input type="hidden" value="" id="redirect_url" name="submitted[redirect_url]">
                                <input type="text" class="form-text name1" maxlength="128" size="60" value="" name="submitted[name]" id="edit-submitted-name" placeholder="Enter Email">
                             </div>
                              <div id="webform-component-pass">
                                <input type="password" class="form-text pass1" id="password" name="submitted[pass]" placeholder="Enter Password" maxlength="128" size="60" value="" >
                                <input type="hidden" value="" name="details[sid]" id="sid">
                                <input type="hidden" value="1" name="details[page_num]" id="page_num">
                                <input type="hidden" value="1" name="details[page_count]" id="page_count">
                                <input type="hidden" value="0" name="details[finished]" id="finished">
                                <input type="hidden" value="form-_OBf1JYKx79Qg5_hsPtYAWmCPrRX6DwFKSODz4M7Wk4" name="form_build_id" id="form_build_id">
                                <input type="hidden" value="webform_client_form_52" name="form_id" id="form_id">
                                <input type="hidden" value="webform-ajax-wrapper-52" name="webform_ajax_wrapper_id" id="webform_ajax_wrapper_id">
                                </div>
                                <input type="submit" value="" name="op" class="form-submit ajax-processed" id="submit"><span class="termss">I accept Senior Search's Terms of Use.</span>
                            </form>

You need to send every one of those parameters with your AJAX script if you want the login to work. 如果您希望登录有效,则需要使用AJAX脚本发送这些参数中的每个参数。

I created the signin and signup form in drupal without any header, footer and sidebar, so There is only form there and call that page in wordpress site using iframe. 我在drupal中创建了登录和注册表单,没有任何页眉,页脚和侧边栏,因此那里只有表单,可以使用iframe在wordpress网站中调用该页面。 Then refresh the iframe top window in drupal code after successful login. 成功登录后,然后以drupal代码刷新iframe顶部窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM