]> git.mxchange.org Git - friendica.git/commitdiff
allow login by username and multiple unique email addresses on system - this will...
authorMike Macgirvin <mike@macgirvin.com>
Sun, 17 Oct 2010 03:38:27 +0000 (20:38 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sun, 17 Oct 2010 03:38:27 +0000 (20:38 -0700)
README
include/auth.php
mod/register.php
mod/settings.php
view/login.tpl

diff --git a/README b/README
index 36b7810bf0da8b4213cc6f4c4829ceef43328849..b4d51bd14c0de9673905a27db040141d7e3c3a80 100644 (file)
--- a/README
+++ b/README
@@ -51,7 +51,4 @@ You may also contact the author and raise issues via the source code
 repository on github -- http://github.com/macgirvin/mistpark
 
 It's your network now. If social networking isn't what you thought it would 
-be, help us to make it better.  
-
-Please support mistpark with a donation.  
-
+be, help us to make it better.
index 10d0df64551b7d6212b21f653361b53aa86c3c36..f4f75c607bcbcb0e4faa692ad3f5296c9251ddd7 100644 (file)
@@ -66,7 +66,8 @@ else {
                // process login request
 
                $r = q("SELECT * FROM `user` 
-                       WHERE `email` = '%s' AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+                       WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+                       dbesc(trim($_POST['login-name'])),
                        dbesc(trim($_POST['login-name'])),
                        dbesc($encrypted));
                if(($r === false) || (! count($r))) {
index a2cae99617b28d5ab46ba2a541784c4b9c9a253a..890bc69b7d15ea6fae8c68b7595b8747bb3e8b0f 100644 (file)
@@ -59,21 +59,12 @@ function register_post(&$a) {
        if(! preg_match("/^[a-zA-Z]* [a-zA-Z]*$/",$username))
                $err .= t(' That doesn\'t appear to be your full name.');
 
-
-       $r = q("SELECT `uid` FROM `user` 
-               WHERE `email` = '%s' LIMIT 1",
-               dbesc($email)
-       );
-
        if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
                        $err .= t(' Not valid email.');
 
        if(! allowed_email($email))
                        $err .= t(' Your email domain is not among those allowed on this site.');
 
-       if($r !== false && count($r))
-               $err .= t(' Your email address is already registered on this system.') ;
-
        $nickname = strtolower($nickname);
        if(! preg_match("/^[a-z][a-z0-9\-\_]*$/",$nickname))
                $err .= t(' Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.') ;
index cfd0df0245f6dda227ed3857470408939b1db482..b76d9ffb9e9e96729553e848836439af875054df 100644 (file)
@@ -81,28 +81,23 @@ function settings_post(&$a) {
                if(strlen($username) < 3)
                        $err .= t(' Name too short.');
        }
+
        if($email != $a->user['email']) {
                $email_changed = true;
                if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
                        $err .= t(' Not valid email.');
-               $r = q("SELECT `uid` FROM `user`
-                       WHERE `email` = '%s' LIMIT 1",
-                       dbesc($email)
-                       );
-               if($r !== NULL && count($r))
-                       $err .= t(' This email address is already registered.');
        }
 
-        if(strlen($err)) {
-                notice($err . EOL);
-                return;
-        }
+       if(strlen($err)) {
+               notice($err . EOL);
+               return;
+       }
+
        if($timezone != $a->user['timezone']) {
                if(strlen($timezone))
                        date_default_timezone_set($timezone);
        }
 
-
        $str_group_allow   = perms2str($_POST['group_allow']);
        $str_contact_allow = perms2str($_POST['contact_allow']);
        $str_group_deny    = perms2str($_POST['group_deny']);
@@ -155,6 +150,7 @@ function settings_post(&$a) {
 
 if(! function_exists('settings_content')) {
 function settings_content(&$a) {
+
        $o .= '<script> $(document).ready(function() { $(\'#nav-settings-link\').addClass(\'nav-selected\'); });</script>';
 
        if(! local_user()) {
index c7cae1bb71db4a06244ffce592af49d2ab343025..39fadb1236c03204e2f97e18b6e146b602aa4189 100644 (file)
@@ -2,7 +2,7 @@
 <form action="" method="post" >
 <input type="hidden" name="auth-params" value="login" />
 <div id="login-name-wrapper">
-        <label for="login-name" id="label-login-name">Email address: </label>
+        <label for="login-name" id="label-login-name">Username or Email: </label>
         <input type="text" maxlength="60" name="login-name" id="login-name" value="" />
 </div>
 <div id="login-name-end" ></div>