[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3262] trunk



Revision: 3262
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3262&view=rev
Author:   einhverfr
Date:     2011-06-16 09:37:45 +0000 (Thu, 16 Jun 2011)

Log Message:
-----------
first draft of password change wrapper.  Not hooked up yet or debugged, but not interfering with anything

Modified Paths:
--------------
    trunk/UI/login.html
    trunk/UI/login.js
    trunk/scripts/user.pl

Added Paths:
-----------
    trunk/UI/users/preferences.js
    trunk/UI/util.js

Modified: trunk/UI/login.html
===================================================================
--- trunk/UI/login.html	2011-06-16 04:49:02 UTC (rev 3261)
+++ trunk/UI/login.html	2011-06-16 09:37:45 UTC (rev 3262)
@@ -1,7 +1,7 @@
 <?lsmb INCLUDE 'ui-header.html' 
 	titlebar = "LedgerSMB $VERSION"
 	include_stylesheet = ["UI/login.css", "css/ledgersmb.css"]
-	include_script = ["UI/login.js"]
+	include_script = ['UI/util.js', "UI/login.js"]
 ?>
 <?lsmb PROCESS elements.html ?>
 

Modified: trunk/UI/login.js
===================================================================
--- trunk/UI/login.js	2011-06-16 04:49:02 UTC (rev 3261)
+++ trunk/UI/login.js	2011-06-16 09:37:45 UTC (rev 3262)
@@ -1,14 +1,3 @@
-// Note: we do not heed to try other interfaces since we don't support IE 6 or
-// lower.  If we need to support other interfaces later, we can add them.
-// --CT
-function get_http_request_object(){
-	if (typeof XMLHttpRequest == undefined){
-		return false;
-	} else {
-		return new XMLHttpRequest();
-	}
-}
-
 function submit_form() {
 	var http = get_http_request_object();
     var username = document.login.login.value;

Added: trunk/UI/users/preferences.js
===================================================================
--- trunk/UI/users/preferences.js	                        (rev 0)
+++ trunk/UI/users/preferences.js	2011-06-16 09:37:45 UTC (rev 3262)
@@ -0,0 +1,32 @@
+
+function submit_form() {
+	var http = get_http_request_object();
+	var login = document.pref.username.value;
+	var old_password = document.pref.old_password.value;
+	var new_password = document.pref.new_password.value;
+	var confirm_pass = document.pref.confirm_password.value;
+	http.open("get", 'user.pl?action=change_password' +
+                          '&old_password='+old_password+
+                          '&new_password='+new_password+
+                          '&confirm_password='+ confirm_pass 
+                          false, login, old_password);
+	http.send("");
+        if (http.status != 200){
+                if (http.status != '454'){
+  		     alert("Access Denied:  Bad username/Password");
+                } else {
+                     alert('Company does not exist.');
+                }
+		return false;
+	}
+    http.open("get", "login.pl?action=authenticate", false, 
+		login, new_password
+    );
+    if (http.status == 200){
+       document.pref.old_password.value = '';
+       document.pref.new_password.value = '';
+       document.pref.confirm_password.value = '';
+    }
+    return true;
+}
+

Added: trunk/UI/util.js
===================================================================
--- trunk/UI/util.js	                        (rev 0)
+++ trunk/UI/util.js	2011-06-16 09:37:45 UTC (rev 3262)
@@ -0,0 +1,12 @@
+
+// Note: we do not heed to try other interfaces since we don't support IE 6 or
+// lower.  If we need to support other interfaces later, we can add them.
+// --CT
+function get_http_request_object(){
+	if (typeof XMLHttpRequest == undefined){
+		return false;
+	} else {
+		return new XMLHttpRequest();
+	}
+}
+

Modified: trunk/scripts/user.pl
===================================================================
--- trunk/scripts/user.pl	2011-06-16 04:49:02 UTC (rev 3261)
+++ trunk/scripts/user.pl	2011-06-16 09:37:45 UTC (rev 3262)
@@ -50,3 +50,13 @@
     $user->save_preferences;
     preference_screen($user);
 }
+
+sub change_password {
+    my ($request) = @_;
+    my $user = LedgerSMB::DBObject::User->new({base => $request});
+    $user->{dateformat} =~ s/$slash/\//g;
+    if ($user->{confirm_password}){
+        $user->change_my_password;
+    }
+    preference_screen($user);
+}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.