]> git.mxchange.org Git - friendica.git/commitdiff
works on login form
authorFabio Comuni <fabrix.xm@gmail.com>
Mon, 17 Oct 2011 14:53:59 +0000 (16:53 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Mon, 17 Oct 2011 14:53:59 +0000 (16:53 +0200)
.htaccess
boot.php
include/auth.php
view/login.tpl
view/register-link.tpl [deleted file]
view/theme/duepuntozero/style.css
view/theme/loozah/style.css
view/theme/testbubble/login.tpl [deleted file]
view/theme/testbubble/style.css

index 73031b962e02e02be9d8c7dd342cbb05bd727a06..3ababd7706679f798ca81cde4bb39c88ab2d6f63 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,4 +1,4 @@
-Options -Indexes
+#Options -Indexes
 AddType application/x-java-archive .jar
 AddType audio/ogg .oga
 
@@ -8,7 +8,7 @@ Deny from all
 
 <IfModule mod_rewrite.c>
   RewriteEngine on
-
+  RewriteBase /~fabio/friendika/
   # Protect repository directory from browsing
   RewriteRule "(^|/)\.git" - [F]
 
index 9f382b3022c21ed3b425464a8982caf2710be024..e7cd065044590037799033360844b844822b6a52 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -636,29 +636,16 @@ function get_guid($size=16) {
 if(! function_exists('login')) {
 function login($register = false) {
        $o = "";
-       $register_tpl = (($register) ? get_markup_template("register-link.tpl") : "");
-       
-       $register_html = replace_macros($register_tpl,array(
-               '$title' => t('Create a New Account'),
-               '$desc' => t('Register')
-       ));
-
-       $noid = get_config('system','no_openid');
-       if($noid) {
-               $classname = 'no-openid';
-               $namelabel = t('Nickname or Email address: ');
-               $passlabel = t('Password: ');
-               $login     = t('Login');
-       }
-       else {
-               $classname = 'openid';
-               $namelabel = t('Nickname/Email/OpenID: ');
-               $passlabel = t("Password \x28if not OpenID\x29: ");
-               $login     = t('Login');
+       $reg = false;
+       if ($register) {
+               $reg = array(
+                       'title' => t('Create a New Account'),
+                       'desc' => t('Register')
+               );
        }
-       $lostpass = t('Forgot your password?');
-       $lostlink = t('Password Reset');
 
+       $noid = get_config('system','no_openid');
+       
        if(local_user()) {
                $tpl = get_markup_template("logout.tpl");
        }
@@ -667,17 +654,22 @@ function login($register = false) {
 
        }
 
-       $o = '<script type="text/javascript"> $(document).ready(function() { $("#login-name").focus();} );</script>';   
 
        $o .= replace_macros($tpl,array(
                '$logout'        => t('Logout'),
-               '$register_html' => $register_html, 
-               '$classname'     => $classname,
-               '$namelabel'     => $namelabel,
-               '$passlabel'     => $passlabel,
-               '$login'         => $login,
-               '$lostpass'      => $lostpass,
-               '$lostlink'      => $lostlink 
+               '$login'                 => t('Login'),
+               
+               '$lname'                => array('username', t('Nickname or Email address: ') , '', ''),
+               '$lpassword'    => array('password', t('Password: '), '', ''),
+               
+               '$openid'               => !$noid,
+               '$lopenid'      => array('openid_url', t('OpenID: '),'',''),
+               
+               
+               '$register'             => $reg,
+               
+               '$lostpass'      => t('Forgot your password?'),
+               '$lostlink'      => t('Password Reset'),
        ));
 
        call_hooks('login_hook',$o);
index 1f16b350479a9074da639249f35cb336eee229bc..45c71c66b3db7944312189b2c7186885f2598f80 100644 (file)
@@ -104,11 +104,12 @@ else {
        if((x($_POST,'password')) && strlen($_POST['password']))
                $encrypted = hash('whirlpool',trim($_POST['password']));
        else {
-               if((x($_POST,'openid_url')) && strlen($_POST['openid_url'])) {
+               if((x($_POST,'openid_url')) && strlen($_POST['openid_url']) ||
+                  (x($_POST,'username')) && strlen($_POST['username'])) {
 
                        $noid = get_config('system','no_openid');
 
-                       $openid_url = trim($_POST['openid_url']);
+                       $openid_url = trim(  (strlen($_POST['openid_url'])?$_POST['openid_url']:$_POST['username']) );
 
                        // validate_url alters the calling parameter
 
@@ -161,7 +162,7 @@ else {
                $record = null;
 
                $addon_auth = array(
-                       'username' => trim($_POST['openid_url']), 
+                       'username' => trim($_POST['username']), 
                        'password' => trim($_POST['password']),
                        'authenticated' => 0,
                        'user_record' => null
@@ -187,8 +188,8 @@ else {
                        $r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`  
                                FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) 
                                AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
-                               dbesc(trim($_POST['openid_url'])),
-                               dbesc(trim($_POST['openid_url'])),
+                               dbesc(trim($_POST['username'])),
+                               dbesc(trim($_POST['username'])),
                                dbesc($encrypted)
                        );
                        if(count($r))
@@ -196,7 +197,7 @@ else {
                }
 
                if((! $record) || (! count($record))) {
-                       logger('authenticate: failed login attempt: ' . trim($_POST['openid_url'])); 
+                       logger('authenticate: failed login attempt: ' . trim($_POST['username'])); 
                        notice( t('Login failed.') . EOL );
                        goaway(z_root());
                }
index 27598cd504b37464a5740199e1fb758f5f48c1a3..5240bb9ad4e188cfd5a33f667278c47f79ce819d 100644 (file)
@@ -1,25 +1,28 @@
 
 <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">$namelabel</label>
-        <input type="text" maxlength="60" name="openid_url" class="$classname" id="login-name" value="" />
-</div>
-<div id="login-name-end" ></div>
-<div id="login-password-wrapper">
-        <label for="login-password" id="label-login-password">$passlabel</label>
-        <input type="password" maxlength="60" name="password" id="login-password" value="" />
-</div>
-<div id="login-password-end"></div>
-<div id="login-extra-links" class=".button">
-       <div id="login-extra-filler">&nbsp;</div>
-       $register_html
+       <input type="hidden" name="auth-params" value="login" />
+
+       <div id="login_standard">
+       {{ inc field_input.tpl with $field=$lname }}{{ endinc }}
+       {{ inc field_password.tpl with $field=$lpassword }}{{ endinc }}
+       </div>
+       
+       {{ if $openid }}
+                       <div id="login_openid">
+                       {{ inc field_openid.tpl with $field=$lopenid }}{{ endinc }}
+                       </div>
+       {{ endif }}
+
+       <div id="login-extra-links">
+               {{ if $register }}<a href="register" title="$register.title" id="register-link">$register.desc</a>{{ endif }}
         <a href="lostpass" title="$lostpass" id="lost-password-link" >$lostlink</a>
-</div>
-<div id="login-extra-end"></div>
-<div id="login-submit-wrapper" >
-        <input type="submit" name="submit" id="login-submit-button" value="$login" />
-</div>
-<div id="login-submit-end"></div>
+       </div>
+       
+       <div id="login-submit-wrapper" >
+               <input type="submit" name="submit" id="login-submit-button" value="$login" />
+       </div>
+       
 </form>
 
+
+<script type="text/javascript"> $(document).ready(function() { $("#id_$lname.0").focus();} );</script>
diff --git a/view/register-link.tpl b/view/register-link.tpl
deleted file mode 100644 (file)
index 802c5f9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-       <a href="register" title = "$title" id="register-link" >$desc</a>
index 9bb866e7671e8cfa6ce2ea83e7e4569479ff9c5e..6f452cebcce41ac3f562b742a1163c3d88377c7d 100644 (file)
@@ -27,8 +27,7 @@ input {
 
 img { border :0px; }
 
-#id_openid_url,
-.openid {
+.openid input {
    background: url(login-bg.gif) no-repeat;
    background-position: 0 50%;
    padding-left: 18px;
@@ -332,26 +331,23 @@ div.wall-item-content-wrapper.shiny {
        margin-top: 10px;
 }
 
-#label-login-name, #label-login-password, #login-extra-filler {
-       float: left;
-       width: 200px;
-       margin-bottom: 20px;
-}
-
 
-#login-password {
+#login_standard {
+       width: 210px;
        float: left;
-       width: 170px;
+}
+#login_openid {
+       width: 210px;
+       margin-left: 250px;
 }
 
-#login-name {
-       float: left;
-       width: 153px;
+#login_standard input,
+#login_openid input {
+       width: 180px;
 }
 
-#login-name.no-openid {
-       float: left;
-       width: 170px;
+#login-extra-links {
+       clear: both;
 }
 
 #register-link, #lost-password-link {
index c6250c51c1ea855550f6ec924de8708da98d8f04..4470723908310f7b3e0ab5ec0763f8de2c489e3d 100644 (file)
@@ -41,18 +41,21 @@ input:hover {
        cursor: pointer;
 }
 
-#id_openid_url,
-.openid {
+.openid input{
    background-color: #ECECEC !important;
    background: url(login-bg.gif) no-repeat;
    background-position: 0 50%;
    padding-left: 18px;
+   width: 385px !important;
 }
-#id_openid_url:hover,
-.openid:hover {
+
+.openid input:hover {
        background-color: #0CBEFE !important;
 }
 
+
+
+
 option {
        background-color: #ECD6D2;
 }
@@ -451,27 +454,20 @@ nav {
        margin-top: 10px;
 }
 
-#label-login-name, #label-login-password, #login-extra-filler {
-       float: left;
-       width: 200px;
-       margin-bottom: 20px;
-}
-
-
-#login-password {
+#login_standard {
+       width: 480px;
        float: left;
-       width: 170px;
 }
-
-#login-name {
-       float: left;
-       width: 153px;
+#login_openid {
+       width: 480px;
+       margin-left: 490px;
 }
 
-#login-name.no-openid {
-       float: left;
-       width: 170px;
+#login_standard input,
+#login_openid input {
+       width: 180px!important;
 }
+#login-extra-links { clear: both; }
 
 #register-link, #lost-password-link {
        float: left;
@@ -479,9 +475,6 @@ nav {
        margin-right: 15px;
 }
 
-#login-name-end, #login-password-end, #login-extra-end, #login-submit-end {
-       clear: both;
-}
 
 #login-submit-button {
 /*     margin-top: 10px; */
diff --git a/view/theme/testbubble/login.tpl b/view/theme/testbubble/login.tpl
deleted file mode 100644 (file)
index c17950e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-<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">$namelabel</label>
-               <input type="text" maxlength="60" name="openid_url" class="$classname" id="login-name" value="" />
-       </div>
-       <div id="login-name-end" ></div>
-       <div id="login-password-wrapper">
-               <label for="login-password" id="label-login-password">$passlabel</label>
-               <input type="password" maxlength="60" name="password" id="login-password" value="" />
-       </div>
-       <div id="login-password-end"></div>
-       <div id="login-submit-wrapper" >
-               <input type="submit" name="submit" id="login-submit-button" value="$login" />
-                       <a href="lostpass" title="$lostpass" id="lost-password-link" >$lostlink</a>
-       </div>
-       <div id="login-submit-end"></div>
-       <div id="login-extra-links" class=".button">
-               <div id="login-extra-filler">&nbsp;</div>
-               $register_html
-       </div>
-       <div id="login-extra-end"></div>
-</form>
-
index 4a3edc163403e9d5f6d14589f89cbca621121e4f..83afe78f40116a611edd7c8b98bf7d9a7f651b8a 100644 (file)
@@ -823,7 +823,7 @@ profile-jot-banner-wrapper {
 /* ======== */
 
 .tabs {
-       width: 600px;
+       width: 450px;
        list-style: none;
        padding: 10px;
        margin: 0px 0px 10px 0px;
@@ -2101,19 +2101,11 @@ margin-left: 0px;
 /* = Register, Settings, Profile Forms = */
 /* ===================================== */
 
-#id_openid_url,
-.openid {
+.openid input{
        background: url(login-bg.gif) no-repeat;
        background-position: 0 50%;
-       padding-left: 18px !important;
-       width: 385px;
-}
-
-.openid {
-       width: 150px !important;
-}
-#login-password {
-       width: 168px !important;
+       padding-left: 18px;
+       width: 384px!important;
 }
 
 #profile-tabs-wrapper {
@@ -2218,25 +2210,6 @@ margin-left: 0px;
     padding: 5px;
 }
 
-.settings-block {
-       margin-top: 20px;
-       -moz-box-shadow: 1px 2px 6px 0px #959494;
-       -webkit-box-shadow: 1px 2px 6px 0px #959494;
-       box-shadow: 1px 2px 6px 0px #959494;
-       background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f8f8f8), color-stop(1, #f6f6f6) );
-       background:-moz-linear-gradient( center top, #f8f8f8 5%, #f6f6f6 100% );
-       filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#f6f6f6');
-       background-color:#f8f8f8;
-       -moz-border-radius:5px;
-       -webkit-border-radius:5px;
-       border-radius:5px;
-       border:1px solid #eee;
-       color:#a6a6a6;
-       text-shadow:-1px 0px 0px #bdbdbd;
-       border: 1px solid #cdcdcd;
-       padding: 5px;
-}
-
 #register-form div,
 #profile-edit-form div { 
        clear: both;
@@ -2621,10 +2594,6 @@ tr {
        width: 150px;   
 }
 
-.directory-end {
-       clear: both;
-}
-
 /* ========= */
 /* = Admin = */
 /* ========= */