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

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



Revision: 3398
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3398&view=rev
Author:   einhverfr
Date:     2011-07-01 09:07:15 +0000 (Fri, 01 Jul 2011)

Log Message:
-----------
Correcting bug 3347848

Modified Paths:
--------------
    trunk/bin/am.pl
    trunk/sql/modules/admin.sql

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2011-07-01 08:12:56 UTC (rev 3397)
+++ trunk/bin/am.pl	2011-07-01 09:07:15 UTC (rev 3398)
@@ -1725,6 +1725,11 @@
 
 sub save_defaults {
     my @defaults;
+    if ($form->{password_duration} =~ /\D/){
+        $form->error(
+           $locale->text('Password duration must be an integer')
+        );
+    }
     for (@default_textboxes){
        push @defaults, $_->{name};
     } 

Modified: trunk/sql/modules/admin.sql
===================================================================
--- trunk/sql/modules/admin.sql	2011-07-01 08:12:56 UTC (rev 3397)
+++ trunk/sql/modules/admin.sql	2011-07-01 09:07:15 UTC (rev 3398)
@@ -289,16 +289,20 @@
 $$
 DECLARE
 	t_expires timestamp;
+        t_password_duration text;
 BEGIN
-    SELECT now() + (value::numeric::text || ' days')::interval INTO t_expires
-    FROM defaults WHERE setting_key = 'password_duration';
+    SELECT value INTO t_password_duration FROM defaults 
+     WHERE setting_key = 'password_duration';
+    IF t_password_duration IS NULL or t_password_duration='' THEN
+        t_expires := 'infinity';
+    ELSE
+        t_expires := now() 
+                     + (t_password_duration::numeric::text || ' days')::interval;
+    END IF;
 
+
     UPDATE users SET notify_password = DEFAULT where username = SESSION_USER;
 
-    IF t_expires IS NULL THEN
-        t_expires := 'infinity';
-    END IF;
-
     EXECUTE 'ALTER USER ' || quote_ident(SESSION_USER) || 
             ' with ENCRYPTED password ' || quote_literal(in_new_password) ||
                  ' VALID UNTIL '|| quote_literal(t_expires);


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