该系统为使用PHP开发的基于web的Subversion(SVN)服务器端管理工具。支持功能:SVN仓库管理、SVN用户管理、SVN分组管理、目录授权、目录浏览、Hooks管理、在线dump备份、在线备份恢复、SVN用户禁用、服务器状态管理、日志管理、消息通知、更新检测...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

135 lines
4.0 KiB

<?php
/*
* @Author: witersen
* @Date: 2022-04-24 23:37:05
* @LastEditors: witersen
* @LastEditTime: 2022-05-20 16:29:41
* @Description: QQ:1801168257
*/
namespace app\service;
class Personal extends Base
{
/**
* 其它服务层对象
*
* @var object
*/
private $Mail;
function __construct()
{
parent::__construct();
$this->Mail = new Mail();
}
/**
* 管理人员修改自己的账号
*/
public function EditAdminUserName()
{
if ($this->payload['userName'] != $this->payload['confirm']) {
return message(200, 0, '输入不一致');
}
if (trim($this->payload['userName']) == '') {
return message(200, 0, '用户名不合法');
}
$info = $this->database->get('admin_users', [
'admin_user_name'
], [
'admin_user_name' => $this->payload['userName']
]);
if ($info != null) {
return message(200, 0, '与已有用户冲突');
}
$this->database->update('admin_users', [
'admin_user_name' => $this->payload['userName']
], [
'admin_user_name' => $this->userName
]);
//邮件
$this->Mail->SendMail('Personal/EditAdminUserName', '管理人员修改账号通知', '原账号:' . $this->userName . ' ' . '新账号:' . $this->payload['userName'] . ' ' . '时间:' . date('Y-m-d H:i:s'));
return message(200, 1, '修改密码成功');
}
/**
* 管理人员修改自己的密码
*/
public function EditAdminUserPass()
{
if ($this->payload['password'] != $this->payload['confirm']) {
return message(200, 0, '输入不一致');
}
if (trim($this->payload['password']) == '') {
return message(200, 0, '密码不合法');
}
$this->database->update('admin_users', [
'admin_user_password' => $this->payload['password']
], [
'admin_user_name' => $this->userName
]);
//邮件
$this->Mail->SendMail('Personal/EditAdminUserPass', '管理人员修改密码通知', '账号:' . $this->userName . ' ' . '时间:' . date('Y-m-d H:i:s'));
return message(200, 1, '修改密码成功');
}
/**
* SVN用户修改自己的密码
*/
public function EditSvnUserPass()
{
if ($this->payload['newPassword'] != $this->payload['confirm']) {
return message(200, 0, '输入不一致');
}
//获取SVN指定用户的密码
$result = $this->SVNAdminUser->GetPassByUser($this->passwdContent, $this->userName);
if ($result == '0') {
return message(200, 0, '文件格式错误(不存在[users]标识)');
}
if ($result == '1') {
return message(200, 0, '用户不存在');
}
if (trim($this->payload['newPassword']) == '') {
return message(200, 0, '密码不合法');
}
if ($result != $this->payload['oldPassword']) {
return message(200, 0, '旧密码输入错误');
}
//修改SVN指定用户的密码
$result = $this->SVNAdminUser->UpdSvnUserPass($this->passwdContent, $this->userName, $this->payload['newPassword']);
if ($result == '0') {
return message(200, 0, '文件格式错误(不存在[users]标识)');
}
if ($result == '1') {
return message(200, 0, '用户不存在');
}
FunFilePutContents($this->config_svn['svn_passwd_file'], $result);
$this->database->update('svn_users', [
'svn_user_pass' => $this->payload['newPassword']
], [
'svn_user_name' => $this->userName
]);
//邮件
$this->Mail->SendMail('Personal/EditSvnUserPass', 'SVN用户修改密码通知', '账号:' . $this->userName . ' ' . '新密码:' . $this->payload['newPassword'] . ' ' . '时间:' . date('Y-m-d H:i:s'));
return message(200, 1, '修改密码成功');
}
}