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

SF.net SVN: ledger-smb: [83] trunk/bin/mozilla/admin.pl



Revision: 83
          http://svn.sourceforge.net/ledger-smb/?rev=83&view=rev
Author:   einhverfr
Date:     2006-09-13 09:20:39 -0700 (Wed, 13 Sep 2006)

Log Message:
-----------
Added Jason Rogriguez's admin.pl password patch.

Modified Paths:
--------------
    trunk/bin/mozilla/admin.pl

Modified: trunk/bin/mozilla/admin.pl
===================================================================
--- trunk/bin/mozilla/admin.pl	2006-09-13 13:58:08 UTC (rev 82)
+++ trunk/bin/mozilla/admin.pl	2006-09-13 16:20:39 UTC (rev 83)
@@ -61,6 +61,9 @@
 }
 
 
+
+
+
 if ($form->{action}) {
 
 	&check_password unless $form->{action} eq 'logout';
@@ -76,13 +79,19 @@
 		open(FH, ">$memberfile") or $form->error("$memberfile : $!");
 		print FH qq|# LedgerSMB Accounting members
 
-		[root login]
-		password=
-
-		|;
+[root login]
+password=
+|;
 		close FH;
 	}
 
+	$root = new User "$memberfile", "root login";
+
+	unless($root && $root->{password}) { 
+		 &setup_initial_password();
+		 exit;
+	}
+
 	&adminlogin;
 }
 
@@ -90,6 +99,42 @@
 # end
 
 
+sub setup_initial_password {
+	
+
+	$form->header();
+	print qq|
+	<body class="admin" onload="sf()">
+	<div align="center">
+		<a href="http://sourceforge.net/projects/ledger-smb/";><img src="ledger-smb.png" width="200" height="100" border="0" alt="LedgerSMB Logo" /></a>
+		<h1 class="login">|.$locale->text('Version').qq| $form->{version} <br />|.$locale->text('Administration').qq|</h1>
+		
+		<fieldset><legend>Change password</legend>
+		<p>This is your first time logging into LedgerSMB.  Please set your administrative password</p>
+		
+		<form method="post" action="$form->{script}" name="admin">
+						<table>
+						<tr>
+							<th align="right">|.$locale->text('Password').qq|</th>
+							<td><input type="password" name="new_password" /></td>
+						</tr>
+						<tr>
+							<th align="right">|.$locale->text('Confirm').qq|</th>
+							<td><input type="password" name="confirm_password" /></td>
+						</tr>
+					</table>
+		<input type="hidden" name="path" value="$form->{path}" />
+		<input type="hidden" name="sessionid" value="$form->{sessionid}" />
+		<p><input type="submit" class="submit" name="action" value="|.$locale->text('Change Password').qq|" /></p>
+		</form>
+
+		<a href="http://sourceforge.net/projects/ledger-smb/";>LedgerSMB |.$locale->text('website').qq|</a>
+	</div>
+	</body>
+	</html>
+|;	
+}
+
 sub adminlogin {
 
 	$form->{title} = qq|LedgerSMB $form->{version} |.$locale->text('Administration');


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