Difference between revisions of "Auto Append Domain"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) (Created page with "==Purpose== To allow people to log in with simple first.last names without having to add domain information. <br> <br> In this case I was using a plugin for kerberos based aut...") |
Michael.mast (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
<br> | <br> | ||
In this case I was using a plugin for kerberos based authentication. If that failed, I needed users to log in with their standard user names. To do this I needed Wordpress to add the domain to the user name and use it as their "email address". | In this case I was using a plugin for kerberos based authentication. If that failed, I needed users to log in with their standard user names. To do this I needed Wordpress to add the domain to the user name and use it as their "email address". | ||
− | *In wp-login.php, add the following lines before<br> | + | ==process== |
+ | *In wp-login.php, add the following lines before<ref>https://stackoverflow.com/questions/18925104/check-if-preg-match-false-instead-of-true</ref><ref>https://secure.php.net/manual/en/function.preg-match.php</ref><ref>https://stackoverflow.com/questions/4366730/how-do-i-check-if-a-string-contains-a-specific-word</ref><ref>https://www.php.net/manual/en/function.isset.php</ref><ref>https://www.php.net/manual/en/language.operators.string.php</ref><br> | ||
<nowiki>/**</nowiki><br> | <nowiki>/**</nowiki><br> | ||
<nowiki> * Output the login page header.</nowiki> | <nowiki> * Output the login page header.</nowiki> | ||
<pre> | <pre> | ||
+ | $testinput = ''; | ||
if (isset($_POST['log'])) { | if (isset($_POST['log'])) { | ||
$testinput = $_POST['log']; | $testinput = $_POST['log']; |
Latest revision as of 21:16, 12 April 2019
Purpose
To allow people to log in with simple first.last names without having to add domain information.
In this case I was using a plugin for kerberos based authentication. If that failed, I needed users to log in with their standard user names. To do this I needed Wordpress to add the domain to the user name and use it as their "email address".
process
/**
* Output the login page header.
$testinput = ''; if (isset($_POST['log'])) { $testinput = $_POST['log']; if (!preg_match('/@/', $testinput)) { $_POST['log'] .= '@domain.tld'; } }
- ↑ https://stackoverflow.com/questions/18925104/check-if-preg-match-false-instead-of-true
- ↑ https://secure.php.net/manual/en/function.preg-match.php
- ↑ https://stackoverflow.com/questions/4366730/how-do-i-check-if-a-string-contains-a-specific-word
- ↑ https://www.php.net/manual/en/function.isset.php
- ↑ https://www.php.net/manual/en/language.operators.string.php