Browse Source

Merge branch 'elmo2k3-generate_password'

New: "Generate password"-button
Thomas Leister 10 năm trước cách đây
mục cha
commit
d29e2ff2c7
2 tập tin đã thay đổi với 18 bổ sung2 xóa
  1. 6 1
      include/php/pages/admin/edituser.php
  2. 12 1
      include/php/template/header.php

+ 6 - 1
include/php/pages/admin/edituser.php

@@ -193,6 +193,11 @@
 		<td>
 			<input name="password" class="textinput" type="password" placeholder="New password"/></br>
 			<input name="password_rep"  class="textinput" type="password" placeholder="New password (repeat)"/>
+			
+			<p>
+				<input type="button" class="button button-small" name="Text 1" value="Generate password"
+				      onclick="pass=generatePassword();this.form.password.value=pass;this.form.password_rep.value=pass;this.form.password.type='text';this.form.password_rep.type='text'">
+			</p>
 		</td>
 		
 		<?php if(defined('DBC_USERS_MAILBOXLIMIT')){ ?>
@@ -210,4 +215,4 @@
 	<p>
 		<input type="submit" class="button button-small" value="Save settings">
 	</p>
-</form>
+</form>

+ 12 - 1
include/php/template/header.php

@@ -3,6 +3,17 @@
 	<head>
 		<title>WebMUM</title>
 		<link rel=stylesheet href="<?php echo FRONTEND_BASE_PATH; ?>include/css/style.css" type="text/css" media=screen>
+		<script type="text/javascript">
+		function generatePassword() {
+		    var length = 9,
+			charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#",
+			retVal = "";
+		    for (var i = 0, n = charset.length; i < length; ++i) {
+			retVal += charset.charAt(Math.floor(Math.random() * n));
+		    }
+		    return retVal;
+		}
+		</script>
 	</head>
 	
 	<body>
@@ -14,4 +25,4 @@
 			</div>
 		</div>
 		
-		<div id="content"> <!-- Opening content -->
+		<div id="content"> <!-- Opening content -->