1

I need to change my user registration and login pages into a secure sub domain of my site, how is it possible ? In detail,

When user logon to http://www.mysite.com/admin that must be redirected to https://admin.mysite.com and he can login from there to our main site .Is it possible ?

  • Why not just put /user and /admin under HTTPS on the main site? – David Thomas Jun 7 '14 at 8:38
0

Yes it is possible through Services module.

First you need to redirect http://www.mysite.com/admin URL to https://admin.mysite.com/ URL either through Apache redirect or through drupal redirection. Then you will capture all the information of user at this site (https://admin.mysite.com/) and consume the same at http://www.mysite.com/admin site through services module.

You can send user information in JSON or XML format, some other formats are also available there these too are more in use.

Now let's take a example:

Site: https://admin.mysite.com/ 1. Created user signup page here with some fields. Here I am taking following fields and send these fields data using JSON to respective URL (http://www.mysite.com/user-register/user/register).

{
    "name": "testuser",
    "pass": "12346",
    "mail": "test@example.com",
    "conf_mail": "test@example.com",
    "field_mobile_number": {
        "und": [
            {
                "value": 12345678
            }
        ]
    },
}

2. Similarly for Sign in page, create form with two fields name and password and prepare following JSON that we would consume to this URL (http://www.mysite.com/user-register/user/login).

{
    "username": "admin",
    "password": "admin123"
}

That's done from this site. Now move on to another site.

Site: http://www.mysite.com/

  1. Enabled Services module.
  2. Create services end point.
  3. For more security you can also use Oauth module.
  4. Please go through following tutorial and follow the same steps and you would be ready to consume above services on this site.

Register User with Services (JSON) with Custom Fields

http://www.wdtutorials.com/2013/04/11/drupal-7-tutorial-web-services-basics

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.