This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Allow guest to create their own user using phone number [SMS Gateway]

Hi everyone

First of all, sorry for my bad English because English is not my native language.

In this post I will give you all some tips to allow guests to create their own user account using their phone number. Instead of using exist SMS Gateway provided by Sophos XG Firewall, I use SMS Gateway Me

- Install SMS Gateway API app into you android phone

- Register an account to use the service

- Create a new SMS Gateway and set it up like picture below

- Check Enable Guest Users Registration at [System => Authentication => Guest User Settings]

- Set up hotspot to redirect website to http://sfos-ip:8090 to go to captive portal

- Create a drop rule below hotspot rule to redirect all unauthenticated user to captive portal



This thread was automatically locked due to age.
Parents Reply Children
  • Dan,

    There are no direct step-by-step tutorials for this exact use-case unfortunately, and it would be a bit excessive if I were to try and create one in a forum post. The good news is that the web contains innumerable how-to articles for AWS specific services already. The work would be to just identify the pieces you need to research, learn them, and then stitch the steps together.

    Again, the pieces are:

    • Lambda
    • API Gateway
    • Simple Notification Services (SNS)

    To help get you started in the right direction if you are so inclined, here is an over-simplified Lambda function in Node.js you could start with:

    const myNum = '+15551234567';
    const AWS = require('aws-sdk');
    const response = {
       statusCode: 500,
       headers: {
          'Access-Control-Allow-Origin': '*',
          'Access-Control-Allow-Credentials' : true
       },
       body: JSON.stringify('You should never see this!'),
    };

    AWS.config.update({
       'region': 'us-east-1'
    });

    exports.handler = async event => {
       try {
          let num = "+1"+event.queryStringParameters.num;
          let msg = event.queryStringParameters.msg;
          let sns = new AWS.SNS( );
          await sns.publish({Message: msg, PhoneNumber: num}).promise( );
          await sns.publish({Message: `New Registration with number ${num}`, PhoneNumber: myNum}).promise( );
          response.statusCode = 200;
          response.body = JSON.stringify('Message sent!')
       } catch(e) {
          console.log("I caught an Error!");
          console.log(e);
          response.body = JSON.stringify({
             error : e.name,
             message: e.message,
             path: event.path,
             method: event.httpMethod,
             query: event.queryStringParameters,
             time: event.requestTime
          });
       } finally {
          return response;
       }
    };

     

    Thanks,

    Gary