This commit is contained in:
liyuchun
2021-11-25 14:14:37 +08:00
3 changed files with 19 additions and 52 deletions

View File

@@ -2064,6 +2064,7 @@ class gitlabModel extends model
$user = fixer::input('post')->remove('avatar')->get();
if(!empty($_FILES['avatar'])) $user->avatar = curl_file_create($_FILES['avatar']['tmp_name'], $_FILES['avatar']['type'], $_FILES['avatar']['name']);
if(empty($user->account)) dao::$errors['account'][] = $this->lang->gitlab->user->bind . $this->lang->gitlab->user->emptyError;
if(empty($user->name)) dao::$errors['name'][] = $this->lang->gitlab->user->name . $this->lang->gitlab->user->emptyError;
if(empty($user->username)) dao::$errors['username'][] = $this->lang->gitlab->user->username . $this->lang->gitlab->user->emptyError;
if(empty($user->email)) dao::$errors['email'][] = $this->lang->gitlab->user->email . $this->lang->gitlab->user->emptyError;
@@ -2114,9 +2115,15 @@ class gitlabModel extends model
*/
public function editUser($gitlabID)
{
$user = fixer::input('post')->remove('username')->removeIF(!$this->post->password, 'password,password_repeat')->remove('avatar')->get();
$user = fixer::input('post')
->setDefault('can_create_group', 0)
->setDefault('external', 0)
->remove('username,avatar')
->removeIF(!$this->post->password, 'password,password_repeat')
->get();
if(!empty($_FILES['avatar'])) $user->avatar = curl_file_create($_FILES['avatar']['tmp_name'], $_FILES['avatar']['type'], $_FILES['avatar']['name']);
if(empty($user->account)) dao::$errors['account'][] = $this->lang->gitlab->user->bind . $this->lang->gitlab->user->emptyError;
if(empty($user->name)) dao::$errors['name'][] = $this->lang->gitlab->user->name . $this->lang->gitlab->user->emptyError;
if(empty($user->email)) dao::$errors['email'][] = $this->lang->gitlab->user->email . $this->lang->gitlab->user->emptyError;
if(dao::isError()) return false;

View File

@@ -19,6 +19,10 @@
</div>
<form id='gitlabForm' method='post' class='form-ajax' enctype="multipart/form-data">
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->user->bind;?></th>
<td class='required'><?php echo html::select('account', $userPairs, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->name;?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control' placeholder='{$lang->gitlab->user->name}'");?></td>
@@ -43,7 +47,7 @@
<td class='required'><?php echo html::password('password_repeat', '', "class='form-control' placeholder='{$lang->gitlab->user->passwordRepeat}'");?></td>
<td class="tips-git"></td>
</tr>
<tr>
<tr class="hidden">
<th><?php echo $lang->gitlab->user->projectsLimit;?></th>
<td><?php echo html::input('projects_limit', 100000, "class='form-control' placeholder='{$lang->gitlab->user->projectsLimit}'");?></td>
</tr>
@@ -61,11 +65,7 @@
<div class="checkbox-primary">
<input type="checkbox" name='external' id="external" value='1'/><label for="external" class="no-margin"><?php echo $lang->gitlab->user->externalTip; ?></label>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->bind;?></th>
<td><?php echo html::select('account', $userPairs, '', "class='form-control chosen'");?></td>
</td>
</tr>
<?php if(function_exists('curl_file_create')):?>
<tr>
@@ -79,26 +79,6 @@
</td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->gitlab->user->skype;?></th>
<td><?php echo html::input('skype', '', "class='form-control' placeholder='{$lang->gitlab->user->skype}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->linkedin;?></th>
<td><?php echo html::input('linkedin', '', "class='form-control' placeholder='{$lang->gitlab->user->linkedin}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->twitter;?></th>
<td><?php echo html::input('twitter', '', "class='form-control' placeholder='{$lang->gitlab->user->twitter}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->websiteUrl;?></th>
<td><?php echo html::input('website_url', '', "class='form-control' placeholder='{$lang->gitlab->user->websiteUrl}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->note;?></th>
<td><?php echo html::textarea('note', '', "rows='10' class='form-control' placeholder='{$lang->gitlab->user->note}'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>

View File

@@ -20,6 +20,10 @@
<form id='gitlabForm' method='post' class='form-ajax' enctype="multipart/form-data">
<?php echo html::hidden('id', $user->id);?>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->user->bind;?></th>
<td class='required'><?php echo html::select('account', $userPairs, $zentaoBindAccount, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->name;?></th>
<td class='required'><?php echo html::input('name', $user->name, "class='form-control' placeholder='{$lang->gitlab->user->name}'");?></td>
@@ -44,7 +48,7 @@
<td><?php echo html::password('password_repeat', '', "class='form-control' placeholder='{$lang->gitlab->user->passwordRepeat}'");?></td>
<td class="tips-git"></td>
</tr>
<tr>
<tr class="hidden">
<th><?php echo $lang->gitlab->user->projectsLimit;?></th>
<td><?php echo html::input('projects_limit', $user->projects_limit, "class='form-control' placeholder='{$lang->gitlab->user->projectsLimit}'");?></td>
</tr>
@@ -64,10 +68,6 @@
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->bind;?></th>
<td><?php echo html::select('account', $userPairs, $zentaoBindAccount, "class='form-control chosen'");?></td>
</tr>
<?php if(function_exists('curl_file_create')):?>
<tr>
<th><?php echo $lang->gitlab->user->avatar;?></th>
@@ -80,26 +80,6 @@
</td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->gitlab->user->skype;?></th>
<td><?php echo html::input('skype', $user->skype, "class='form-control' placeholder='{$lang->gitlab->user->skype}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->linkedin;?></th>
<td><?php echo html::input('linkedin', $user->linkedin, "class='form-control' placeholder='{$lang->gitlab->user->linkedin}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->twitter;?></th>
<td><?php echo html::input('twitter', $user->twitter, "class='form-control' placeholder='{$lang->gitlab->user->twitter}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->websiteUrl;?></th>
<td><?php echo html::input('website_url', $user->website_url, "class='form-control' placeholder='{$lang->gitlab->user->websiteUrl}'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->user->note;?></th>
<td><?php echo html::textarea('note', $user->note, "rows='10' class='form-control' placeholder='{$lang->gitlab->user->note}'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>