• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Captive Portal with login but no authentication

Scheduled Pinned Locked Moved Captive Portal
4 Posts 2 Posters 429 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V
    veldthui
    last edited by May 9, 2024, 1:22 PM

    Is it possible to set up Captive Portal to ask for a user name and log that name but not ask or require a password.
    I want to know who is using my guest network but don't need the passwords so authentication is not needed.

    G 1 Reply Last reply May 9, 2024, 1:46 PM Reply Quote 0
    • G
      Gertjan @veldthui
      last edited by Gertjan May 9, 2024, 1:56 PM May 9, 2024, 1:46 PM

      @veldthui

      That's very possible.
      Start by creating a bunch of users, and give them all the same password, like '123'.

      Now, use this :

      dd879014-8689-4ad8-803c-76a580b1f8ab-image.png

      to make your own 'html/php' captive portal login page :
      I made one up for you :
      Create a file, call it "portal.html" and upload it as a captive portal login page.

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
      <html lang="fr-FR">
      	<head>
      		<title>Brit Hotel Fumel</title>
      		<meta name="viewport" content="width=device-width, user-scalable=no" />
      	</head>
      	<body> 
      		<div style="text-align:center; margin:0 auto;"> 
      			<form method="post" action="$PORTAL_ACTION$">
      				<p>Hello, you are there ..........</p>
      				<p><img src="captiveportal-a-logo-that-I-uploaded.png" class="centerImage" alt="My Portal Logo" ></a></p>
      				<p>Hi there again ....</p>
      				<hr>
      				<p>Would you like to access the Internet ?</p>
      				<p>Then enter your user name here :</p>
      				<input name="auth_user" id="auth_user" type="text" size="12" maxlength="10" placeholder="User name !"/>
      				<p>No, there is no password./p>
      				<input name="auth_pass" type="hidden" value="123" />
      				<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$" />
      				<input name="zone" type="hidden" value="$PORTAL_ZONE$" />
      				<p><input name='accept' type='submit' class='button' value='Acc&eacute;der &agrave; l&acute;Internet' /></p>
      <?php
      	global $config, $cpzone;
      	if(isset($config['voucher'][$cpzone]['enable'])) {
      ?>
      				<p><input name="auth_voucher" type="text" value="#VOUCHER#"/></p>
      <?php
      	}
      ?>
      			</form> 
      		</div> 
      	</body>
      </html>
      

      As you can see : you saw this already a million times in your live time. That is, you browser makes a page out of it. Now you've made the page yourself.
      You probably have to adapt it a bit ^^

      You saw that I used an image called "captiveportal-a-logo-that-I-uploaded.png".
      This means you have to create an image, and all the file "a-logo-that-I-uploaded.png". It should be a png file of course. The suffix "captiveportal-" will get added automatically.

      You can also remove the line where I use the image <p><img src ..... ></p>.

      Use Services > Captive Portal > [CPZON] > File Manager to upload the image file.

      edit : oops. Forgot one thing :
      Copy the portal.html filo to error-page.html.

      Add this line on a strategic place :

      				<p style="color:red;"><b>$PORTAL_MESSAGE$.</b></p>
      

      and upload this error-page.html file as the "Auth error page contents" page.

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      • V
        veldthui
        last edited by May 9, 2024, 1:59 PM

        Thanks for that. It does however look like I need to know the names of the people before hand so as to create the users.
        I have a Guest network that is limited bandwidth but anyone can use and I won't know who they are before hand. That was why I was asking if i could just get them to input their name and no password.

        I think I can use your example for my other Wifi network that is not limited for my immediate neighbors who have asked if they can use it.

        G 1 Reply Last reply May 9, 2024, 2:07 PM Reply Quote 0
        • G
          Gertjan @veldthui
          last edited by May 9, 2024, 2:07 PM

          @veldthui said in Captive Portal with login but no authentication:

          That was why I was asking if i could just get them to input their name

          Why do you want them to enter a name ?
          It's easy to create a text field, and have the content discarded.
          Doing something with name the user entered, like writing it to a file, is another level.
          It is technically possible that the portal login code adds the entered user name as a pfSense user, the ones you can see under "System > User Manager > Users" but this creates a situation where unknown / non trusted users starts to add 'stuff' to the pfSense config file ..... that's far from safe.

          Like the password, you can also hard code a user name : all logged in users will actually use the same login name and password at that moment.

          You don't want to use this method :

          323c1821-1dcc-421d-9eec-bbeed1cabfa6-image.png

          as the user now doesn't have to enter anything, right ?

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          4 out of 4
          • First post
            4/4
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
            This community forum collects and processes your personal information.
            consent.not_received