]> source.dussan.org Git - nextcloud-server.git/commitdiff
Error when only oc_remember_login cookie set fixed.
authorMarvin Thomas Rabe <m.rabe@echtzeitraum.de>
Fri, 30 Sep 2011 16:22:12 +0000 (18:22 +0200)
committerMarvin Thomas Rabe <m.rabe@echtzeitraum.de>
Fri, 30 Sep 2011 16:25:34 +0000 (18:25 +0200)
Filled username field when oc_username is set repaired.
Problems with "advanced settings" button in installation wizard fixed.
CSS improved - login and installation now looks more clean.
Request password link removed (email feature not implemented yet).
Database radio button bugs removed.
It is possible to have an empty database password, now ownCloud will support this "security issue".
Ignore Mac OS X ".DSstore" files.
Fade in/out of login button and remember checkbox removed due to some display errors.

.gitignore
core/css/styles.css
core/js/js.js
core/js/setup.js
core/templates/installation.php
core/templates/login.php
index.php
lib/helper.php
lib/setup.php

index e9dbc1e3f62d7a75e9180cc4ed4969bddc8dfe3a..ea8e5bd42facacb612876ac2d8588d3ac91a3d38 100644 (file)
@@ -31,3 +31,5 @@ RCS/*
 
 # netbeans 
 nbproject
+
+.DS_Store
\ No newline at end of file
index e6728dffbd9d10794cb5ea2e5d760a8b7f93ee60..44331d1998b7ec9c9d30aa3f6fcd45afaf85497c 100644 (file)
@@ -16,7 +16,7 @@ body { background:#fefefe; font:normal .8em/1.6em "Lucida Grande", Arial, Verdan
 
 /* HEADERS */
 #body-user #header, #body-settings #header { position:fixed; top:0; z-index:100; width:100%; height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; box-shadow:0 0 10px #000, inset 0 -2px 10px #222; }
-#body-login #header { margin:-2em auto 0; text-align:center; height:10em;
+#body-login #header { margin: -2em auto 0; text-align:center; height:10em;
  -moz-box-shadow:0 0 1em #000; -webkit-box-shadow:0 0 1em #000; box-shadow:0 0 1em #000;
 background: #1d2d44; /* Old browsers */
 background: -moz-linear-gradient(top, #35537a 0%, #1d2d42 100%); /* FF3.6+ */
@@ -42,7 +42,8 @@ input[type="checkbox"] { width:auto; }
 #quota { cursor:default; }
 
 #body-login input { font-size:1.5em; }
-#body-login input[type="submit"] { float:right; margin-right:.8em; }
+#body-login input[type="text"], #body-login input[type="password"] { width: 13em; }
+#body-login input.login { width: auto; float: right; }
 #remember_login { margin:.8em .2em 0 1em; }
 form.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background-image:url('../img/actions/search.svg'); background-repeat:no-repeat; background-position:.5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; }
 input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; }
@@ -61,17 +62,19 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-
 
 /* LOG IN & INSTALLATION ------------------------------------------------------------ */
 #body-login { background:#ddd; }
-#body-login p.info { width:21em; margin:2em auto; color:#777; text-shadow:#fff 0 1px 0; }
+#body-login div.buttons { text-align: center; }
+#body-login p.info { width:22em; text-align: center; margin:2em auto; color:#777; text-shadow:#fff 0 1px 0; }
 #body-login p.info a { font-weight:bold; color:#777; }
 
 #login { min-height:30em; margin:2em auto 0; border-bottom:1px solid #f8f8f8; background:#eee; }
-#login form { width:18em; margin:2em auto 5em; padding:0; }
+#login a#showAdvanced { color: #555; }
+#login form { width:22em; margin:2em auto 2em; padding:0; }
 #login form fieldset { background:0; border:0; margin-bottom:2em; padding:0; }
 #login form fieldset legend { font-weight:bold; }
 #login form label { position:absolute; margin:.8em .8em; font-size:1.5em; color:#666; }
 #login #dbhostlabel, #login #directorylabel { display:block; margin:.95em 0 .8em -8em; }
 #login form input[type="checkbox"]+label { position:relative; margin:0; font-size:1em; text-shadow:#fff 0 1px 0; }
-#login form ul.errors { background:#fed7d7; border:1px solid #f00; list-style-indent:inside; margin:0 0 4em 0; padding:1em 1em 1em 5em; }
+#login form ul.errors { background:#fed7d7; border:1px solid #f00; list-style-indent:inside; margin:0 0 2em; padding:1em; }
 
 #login form #selectDbType { text-align:center; }
 #login form #selectDbType label { position:static; font-size:1em; margin:0 -.3em 1em; cursor:pointer; padding:.4em; border:1px solid #ddd; font-weight:bold; background:#f8f8f8; color:#555; text-shadow:#eee 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; }
index a75e1d41f609abba5e546a3e0f4d183930f870dc..f5abd9df6b3274e916c053ab8d35dfc611033c0d 100644 (file)
@@ -290,6 +290,7 @@ $(document).ready(function(){
        // 'show password' checkbox     
        $('#pass2').showPassword();
 
+       /* @TODO: Currently not working perfect. Remember-Checkbox is flashing.
        // hide log in button etc. when form fields not filled
        $('#submit').hide();
        $('#remember_login').hide();
@@ -312,6 +313,7 @@ $(document).ready(function(){
                        $('#remember_login+label').fadeIn();
                }
        });
+       */
 
        if($('body').attr("id")=="body-user") { $('#settings #expanddiv').hide(); }
        $('#settings #expand').click(function(event) {
index 0ed0ea69120b539753d7d01a5ffd78acc1aed5a6..e16f9b6e3291576f7b90fdf900862c8fdc0de9f4 100644 (file)
@@ -1,8 +1,7 @@
 $(document).ready(function() {
        $('#selectDbType').buttonset();
-       $('#datadirField').hide(250);
+       $('#datadirContent').hide(250);
        if($('#hasSQLite').val()=='true'){
-               $('#databaseField').hide();
                $('#use_other_db').hide();
                $('#dbhost').hide();
                $('#dbhostlabel').hide();
@@ -26,11 +25,10 @@ $(document).ready(function() {
                $('#dbhostlabel').show(250);
        });
 
+       $('input[checked]').trigger('click');
+
        $('#showAdvanced').click(function() {
-               $('#datadirField').slideToggle(250);
-               if($('#hasSQLite').val()=='true'){
-                       $('#databaseField').slideToggle(250);
-               }
+               $('#datadirContent').slideToggle(250);
        });
        $("form").submit(function(){
                // Save form parameters
index 09f9ad8c359d6f1c18deae359a81241ed96224de..e15e81191a91a9d66645c192a96ed2a4b6e01b3b 100644 (file)
                <legend><?php echo $l->t( 'Configure the database' ); ?></legend>
                <div id="selectDbType">
                <?php if($_['hasSQLite']): ?>
-               <input type='hidden' id='hasSQLite' value='true' />
+               <input type='hidden' id='hasSQLite' value="true" />
                <?php if(!$hasOtherDB): ?>
                <p>SQLite <?php echo $l->t( 'will be used' ); ?>.</p>
                <input type="hidden" id="dbtype" name="dbtype" value="sqlite" />
                <?php else: ?>
-               <input type="radio" name="dbtype" value='sqlite' id="sqlite" <?php OC_Helper::init_radio('dbtype', 'sqlite', 'sqlite'); ?>/>
+               <input type="radio" name="dbtype" value="sqlite" id="sqlite" <?php OC_Helper::init_radio('dbtype', 'sqlite', 'sqlite'); ?>/>
                <label class="sqlite" for="sqlite">SQLite</label>
                <?php endif; ?>
                <?php endif; ?>
@@ -43,7 +43,7 @@
                <p>MySQL <?php echo $l->t( 'will be used' ); ?>.</p>
                <input type="hidden" id="dbtype" name="dbtype" value="mysql" />
                <?php else: ?>
-               <input type="radio" name="dbtype" value='mysql' id="mysql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/>
+               <input type="radio" name="dbtype" value="mysql" id="mysql" <?php OC_Helper::init_radio('dbtype','mysql', 'sqlite'); ?>/>
                <label class="mysql" for="mysql">MySQL</label>
                <?php endif; ?>
                <?php endif; ?>
@@ -54,7 +54,7 @@
                <input type="hidden" id="dbtype" name="dbtype" value="pgsql" />
                <?php else: ?>
                <label class="pgsql" for="pgsql">PostgreSQL</label>
-               <input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/>
+               <input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype','pgsql', 'sqlite'); ?>/>
                <?php endif; ?>
                <?php endif; ?>
                </div>
                <?php endif; ?>
 
        </fieldset>
-       
-       <a id='showAdvanced'><strong><?php echo $l->t( 'Advanced' ); ?> ▾</strong></a>
 
-       <fieldset id='datadirField'>
-               <label id="dbhostlabel" for="dbhost"><?php echo $l->t( 'Database host' ); ?></label><input type="text" name="dbhost" id="dbhost" value="<?php print OC_Helper::init_var('dbhost', 'localhost'); ?>" placeholder="<?php echo $l->t( 'Database host' ); ?>" />
-               <label id="directorylabel" for="directory"><?php echo $l->t( 'Data folder' ); ?></label><input type="text" name="directory" id="directory" value="<?php print OC_Helper::init_var('directory', $_['directory']); ?>" placeholder="<?php echo $l->t( 'Data folder' ); ?>" />
+       <fieldset id="datadirField">
+               <legend><a id="showAdvanced"><?php echo $l->t( 'Advanced' ); ?> ▾</a></legend>
+               <div id="datadirContent">
+                       <input type="text" name="dbhost" id="dbhost" value="<?php print OC_Helper::init_var('dbhost', 'localhost'); ?>" placeholder="<?php echo $l->t( 'Database host' ); ?>" />
+                       <input type="text" name="directory" id="directory" value="<?php print OC_Helper::init_var('directory', $_['directory']); ?>" placeholder="<?php echo $l->t( 'Data folder' ); ?>" />
+               </div>
        </fieldset>
 
-       <input type="submit" value="<?php echo $l->t( 'Finish setup' ); ?>" />
+       <div class="buttons"><input type="submit" value="<?php echo $l->t( 'Finish setup' ); ?>" /></div>
 </form>
index 717f6bcabdaf8cb7b42ffc8e1fe3b5668e0bdc1b..56ecf6da9c0945b62cdaa967bff33a64fab7ed3b 100644 (file)
@@ -1,17 +1,17 @@
 <form action="index.php" method="post">
        <fieldset>
-               <?php if($_['error']): ?>
+               <?php /*if($_['error']): ?>
                        <a href="index.php?lostpassword"><?php echo $l->t('Lost your password?'); ?></a>
-               <?php endif; ?>
-               <?php if(empty($_["username"])): ?>
+               <?php endif;*/ ?>
+               <?php if(empty($_['username'])): ?>
                        <input type="text" name="user" id="user" placeholder="Username" value="" autocomplete="off" required autofocus />
                        <input type="password" name="password" id="password" placeholder="Password" value="" required />
-                       <input type="checkbox" name="remember_login" id="remember_login" /><label for="remember_login"><?php echo $l->t('remember'); ?></label>
+                       <input type="checkbox" name="remember_login" value="1" id="remember_login" /><label for="remember_login"><?php echo $l->t('remember'); ?></label>
                <?php else: ?>
                      <input type="text" name="user" id="user" placeholder="Username" value="<?php echo $_['username']; ?>" autocomplete="off" required >
                      <input type="password" name="password" id="password" placeholder="Password" value="" required autofocus />
-                     <input type="checkbox" name="remember_login" id="remember_login" checked /><label for="remember_login"><?php echo $l->t('remember'); ?></label>
+                     <input type="checkbox" name="remember_login" value="1" id="remember_login" checked /><label for="remember_login"><?php echo $l->t('remember'); ?></label>
                <?php endif; ?>
-               <input type="submit" id="submit" value="Log in" />
+               <input type="submit" id="submit" class="login" value="Log in" />
        </fieldset>
 </form>
index 2ac3f6df7bb8479646fc840117420c62119bf9f1..68754fcc567a9ebdc464306061ba544918b6bc20 100644 (file)
--- a/index.php
+++ b/index.php
@@ -53,7 +53,7 @@ elseif(OC_User::isLoggedIn()) {
 }
 
 // remember was checked after last login
-elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
+elseif(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && isset($_COOKIE["oc_username"]) && $_COOKIE["oc_remember_login"]) {
        OC_App::loadApps();
        if(defined("DEBUG") && DEBUG) {error_log("Trying to login from cookie");}
        // confirm credentials in cookie
@@ -63,7 +63,7 @@ elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
                OC_Util::redirectToDefaultPage();
        }
        else {
-               OC_Template::printGuestPage("", "login", array("error" => true));
+               OC_Template::printGuestPage("", "login", array("error" => true, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' ));
        }
 }
 
@@ -81,13 +81,8 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) {
                        OC_User::unsetMagicInCookie();
                }
                OC_Util::redirectToDefaultPage();
-       }
-       else {
-               if(isset($_COOKIE["oc_username"])){
-                       OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["oc_username"]));
-               }else{
-                       OC_Template::printGuestPage("", "login", array("error" => true));
-               }
+       } else {
+               OC_Template::printGuestPage('', 'login', array('error' => true, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' ));
        }
 }
 
@@ -126,11 +121,7 @@ elseif(isset($_GET['resetpassword']) && isset($_GET['token']) && isset($_GET['us
 // For all others cases, we display the guest page :
 else {
        OC_App::loadApps();
-       if(isset($_COOKIE["username"])){
-               OC_Template::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"]));
-       }else{
-               OC_Template::printGuestPage("", "login", array("error" => false));
-       }
+       OC_Template::printGuestPage('', 'login', array('error' => false, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' ));
 }
 
-?>
+?>
\ No newline at end of file
index 1661f38e8ab12ab173d5e34b48f9ca386f196489..b6332b54aea47a596a05a7fc5b624ef0575c38fc 100644 (file)
@@ -266,8 +266,14 @@ class OC_Helper {
                return $r;
        }
        
+       /**
+        * returns "checked"-attribut if request contains selected radio element OR if radio element is the default one -- maybe?
+        * @param string $s Name of radio-button element name
+        * @param string $v Value of current radio-button element
+        * @param string $d Value of default radio-button element
+        */
        public static function init_radio($s, $v, $d) {
-               if((isset($_REQUEST[$s]) && $_REQUEST[$s]==$v) || $v == $d)
+               if((isset($_REQUEST[$s]) && $_REQUEST[$s]==$v) || (!isset($_REQUEST[$s]) && $v == $d))
                        print "checked=\"checked\" ";
        }
 
index 8d3079720ccc498373a30b430051b24bc223b34e..355d979dc65c81b7121a57d81b3ac46c37214348 100644 (file)
@@ -55,9 +55,6 @@ class OC_Setup {
                        if(empty($options['dbuser'])) {
                                $error[] = "$dbprettyname enter the database username.";
                        }
-                       if(empty($options['dbpass'])) {
-                               $error[] = "$dbprettyname enter the database password.";
-                       }
                        if(empty($options['dbname'])) {
                                $error[] = "$dbprettyname enter the database name.";
                        }