ticket #305,同步用户密码

This commit is contained in:
wlx 2012-03-15 10:06:01 +00:00
parent b663db8994
commit b72da31e50
2 changed files with 5 additions and 5 deletions

View File

@ -148,20 +148,20 @@ class Admin_DataController extends Zend_Controller_Action
} }
$this->view->msg='已成功同步缩略图!'; $this->view->msg='已成功同步缩略图!';
} elseif ($adminuser=='geonetwork') { } elseif ($adminuser=='geonetwork') {
$sql="select id,username,password,email from users where usertype='administrator'"; $sql="select id,username,password,email from users";
$rows=$this->db->fetchAll($sql); $rows=$this->db->fetchAll($sql);
foreach($rows as $row) { foreach($rows as $row) {
$sql="select * from geonetworkusers where id=?"; $sql="select * from geonetworkusers where id=?";
$r=$this->db->fetchRow($sql,array($row->id)); $r=$this->db->fetchRow($sql,array($row->id));
if ($r) { if ($r) {
$sql="update geonetworkusers set username='$row->username',password='$row->password',email='$row->email' where id=$row->id"; $sql="update geonetworkusers set username='$row->username',password=encode(digest(md5('$row->password'),'sha1'),'hex'),email='$row->email' where id=$row->id";
$this->db->query($sql); $this->db->query($sql);
} else { } else {
$sql="insert into geonetworkusers (id,username,password,email) values($row->id,'$row->username','$row->password','$row->email')"; $sql="insert into geonetworkusers (id,username,password,email) values($row->id,'$row->username',encode(digest(md5('$row->password'),'sha1'),'hex'),'$row->email')";
$this->db->query($sql); $this->db->query($sql);
} }
} }
$this->view->msg='已成功同步管理员帐号!'; $this->view->msg='已成功同步帐号!';
} }
} }

View File

@ -33,7 +33,7 @@
<p><a href="/admin/data/sync/delete/water">删除WESTDC中多出的WATER元数据</a></p> <p><a href="/admin/data/sync/delete/water">删除WESTDC中多出的WATER元数据</a></p>
<p><a href="/admin/data/sync/thumb/geonetwork">同步GEONETWORK中的缩略图</a></p> <p><a href="/admin/data/sync/thumb/geonetwork">同步GEONETWORK中的缩略图</a></p>
<p><a href="/admin/data/sync/thumb/water">同步WATER中的缩略图</a></p> <p><a href="/admin/data/sync/thumb/water">同步WATER中的缩略图</a></p>
<p><a href="/admin/data/sync/adminuser/geonetwork">同步管理员帐号到GEONETWORK</a></p> <p><a href="/admin/data/sync/adminuser/geonetwork">同步帐号到GEONETWORK(仅供初始化使用)</a></p>
<form method="POST"> <form method="POST">
<p>指定元数据UUID: <input type="text" name="uuid"></p> <p>指定元数据UUID: <input type="text" name="uuid"></p>
<button type="submit" name="submit">同步此元数据</button> <button type="submit" name="submit">同步此元数据</button>