partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 33dd66faf84be49fbe52633fdebbc48df2ad2c0a
parent f1bb3bf8dce284a08dd4061deea23e80d3e49cfb
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu, 23 Jun 2011 12:51:57 +0200

Added auto-login via configuration

Diffstat:
Mfrontend/config.php | 2++
Mfrontend/index.php | 7+++++++
Mfrontend/js/Dialogs/Auth/LoginDialog.js | 6+++++-
Mfrontend/js/PartKeepr.js | 5+++++
4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/frontend/config.php b/frontend/config.php @@ -1,2 +1,3 @@ <?php $debug = true; +$autoLogin = false;+ \ No newline at end of file diff --git a/frontend/index.php b/frontend/index.php @@ -62,6 +62,13 @@ $imagick = new Imagick(); PartKeepr.setMaxUploadSize(<?php echo $maxUploadSize; ?>); PartKeepr.setAvailableImageFormats(<?php echo json_encode($imagick->queryFormats()); ?>); +<?php +if ($autoLogin) { +?> +PartKeepr.setAutoLogin("admin","admin"); +<?php +} +?> </script> </body> </html> \ No newline at end of file diff --git a/frontend/js/Dialogs/Auth/LoginDialog.js b/frontend/js/Dialogs/Auth/LoginDialog.js @@ -58,7 +58,11 @@ Ext.define('PartKeepr.LoginDialog', { this.on("show", function () { this.loginField.focus(); }, this); - //this.loginField.focus(); + if (PartKeepr.autoLoginUsername) { + this.loginField.setValue(PartKeepr.autoLoginUsername); + this.passwordField.setValue(PartKeepr.autoLoginPassword); + this.login(); + } }, login: function () { var call = new PartKeepr.ServiceCall("Auth", "login"); diff --git a/frontend/js/PartKeepr.js b/frontend/js/PartKeepr.js @@ -332,4 +332,9 @@ PartKeepr.serializeRecords = function (records) { } return finalData; +}; + +PartKeepr.setAutoLogin = function (username, password) { + PartKeepr.autoLoginUsername = username; + PartKeepr.autoLoginPassword = password; }; \ No newline at end of file