RADIUSdesk

logo

User Registration - Other Profile Option

  • When User Registration is configured on a Login Page you define a Profile and Realm the registered user will be assigned to.
  • There might however be times that you want to assign the user to a different profile (for whatever reason).
  • We have added this hidden feature and documented it here.

Create other profile

  • Make sure you create the other profile and it has all the features you need (e.g. faster bandwidth)
  • You can use the Profile name or Profile ID in the Login Page.

Tweak sConnect.js

  • In our example we will reward users that register with a phone number that starts with 083 and has a total of 10 digits.
  • Edit /var/www/html/login/bootstrap5/js/sConnect.js.
  • Look for this part:
/*  
                //=== Proof of Concept Hack ===
                //=== other_profile_name = 'Dev_Super_Register'
                var other_profile_name = 'Dev_Super_Register';
                //var other_profile_id = 56; //Alternative
                var phone   = $("#txtrCell").val();
                if(/^072/.test(phone)){
                    formData['other_profile_name']  = other_profile_name;
                    //formData['other_profile_id']    = other_profile_id;
                }
                //=== END Proof of Concept Hack === 
*/              
  • Now for our requirement we change it to the following:
//=== Proof of Concept Hack ===
//=== other_profile_name = 'Dev_Super_Register'
    var other_profile_name = 'MTN-Profile';
    //var other_profile_id = 56; //Alternative
    var phone   = $("#txtrCell").val();
    if(/^083\d{7}$/.test(phone)){
        formData['other_profile_name']  = other_profile_name;
        //formData['other_profile_id']    = other_profile_id;
     }
//=== END Proof of Concept Hack ===
  • This means that if during registration a match on the phone number requirement is found, the user will be registered with the other profile.
  • You can create your own criteria and simply tweak the sConnect.js file.
  • This feature comes in handy if you want to give certain users special treatment based on the value of one of the supplied fields during user registration.