2

I am trying to manage a DokuWiki site designed for school members. The problem is that I have to check whether the new users are actually members of our school.

Since DokuWiki sends temporary password to the email written by a new user, I think it is the best to use our school's domain (e.g., @example.edu.com) to confirm the identity.

Is there a way to 'force' all the new ids to have a 'fixed' email domain? I wish the "sign up" page to show something like this:

User ID : [_______]
Name    : [_______]
Email   : [_______]@example.edu.com

  [Register Button]

Or are there other ways to solve my problem?

1

There are several ways to enforce a fixed domain name for an email address in your email form.

You can set the input to have a hidden field of @example.com at the end, and the user just enter in their own name without the domain in the input field.

You can also check the email address in both javascript or PHP to determine if it ends in example.com. If the check fails, you can alert the user that the email address is invalid or you can redirect them back to the page with a notification that they need to use the school email address.

Here is a basic way to begin doing it that I brewed up for you:

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display the value of the value attribute of the hidden input field.</p>

<input type="" id="myInput" value="" placeholder="enter email">@example.com
<br>

<button onclick="myFunction()">send</button>

<p id="demo"></p>

<script>
function myFunction() {

    var y = '@example.com';
    var x =
    document.getElementById("myInput").value;
    var z = x + y;

    document.getElementById("demo").innerHTML = z;
}
</script>

</body>
</html>

https://jsfiddle.net/ffa5m00j/

  • Sorry it got too late! As I am really a beginner, could you explain which file should I modify in the doku wiki source codes? I can find a lot of php files but have no idea how to modify which one... – Yoonsoo P. Bach May 3 '18 at 0:53

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.