更新
This commit is contained in:
9
src/api/equipment/list.js
Normal file
9
src/api/equipment/list.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import service from '@/utils/request'
|
||||
|
||||
export const resetPassword = (data) => {
|
||||
return service({
|
||||
url: '/user/resetPassword',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
BIN
src/assets/new-background.jpg
Normal file
BIN
src/assets/new-background.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 722 KiB |
@@ -6,7 +6,7 @@ import packageInfo from '../../package.json'
|
||||
const greenText = (text) => `\x1b[32m${text}\x1b[0m`
|
||||
|
||||
export const config = {
|
||||
appName: 'Gin-Vue-Admin',
|
||||
appName: '智慧用电管理系统',
|
||||
showViteLogo: true,
|
||||
KeepAliveTabs: true,
|
||||
logs: []
|
||||
@@ -14,41 +14,6 @@ export const config = {
|
||||
|
||||
export const viteLogo = (env) => {
|
||||
if (config.showViteLogo) {
|
||||
console.log(
|
||||
greenText(
|
||||
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
|
||||
)
|
||||
)
|
||||
console.log(greenText(`> 当前版本:v${packageInfo.version}`))
|
||||
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
|
||||
console.log(
|
||||
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
|
||||
)
|
||||
console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`))
|
||||
console.log(
|
||||
greenText(`> GVA讨论社区:https://support.qq.com/products/371961`)
|
||||
)
|
||||
console.log(
|
||||
greenText(
|
||||
`> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html`
|
||||
)
|
||||
)
|
||||
console.log(
|
||||
greenText(`> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}`)
|
||||
)
|
||||
console.log(
|
||||
greenText(
|
||||
`--------------------------------------版权声明--------------------------------------`
|
||||
)
|
||||
)
|
||||
console.log(greenText(`** 版权所有方:flipped-aurora开源团队 **`))
|
||||
console.log(greenText(`** 版权持有公司:北京翻转极光科技有限责任公司 **`))
|
||||
console.log(
|
||||
greenText(
|
||||
`** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **`
|
||||
)
|
||||
)
|
||||
console.log('\n')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"/src/view/dashboard/components/table.vue": "Table",
|
||||
"/src/view/dashboard/components/wiki.vue": "Wiki",
|
||||
"/src/view/dashboard/index.vue": "Dashboard",
|
||||
"/src/view/equipment/list/index.vue": "User",
|
||||
"/src/view/error/index.vue": "Error",
|
||||
"/src/view/error/reload.vue": "Reload",
|
||||
"/src/view/example/breakpoint/breakpoint.vue": "BreakPoint",
|
||||
|
||||
@@ -115,16 +115,16 @@ const setupRouter = async (userStore) => {
|
||||
// 扁平化:将 layout.children 与其余顶层异步路由一并作为二级子路由注册到 layout 下
|
||||
const toRegister = []
|
||||
if (layoutRoute?.children?.length) {
|
||||
layoutRoute.children.unshift({
|
||||
path: '/largeScreen2',
|
||||
name: 'largeScreen2',
|
||||
meta: {
|
||||
title: '数据大屏',
|
||||
icon: 'data-analysis',
|
||||
defaultMenu: true
|
||||
},
|
||||
component: () => import('@/view/largeScreen2/index.vue')
|
||||
})
|
||||
// layoutRoute.children.unshift({
|
||||
// path: '/largeScreen2',
|
||||
// name: 'largeScreen2',
|
||||
// meta: {
|
||||
// title: '数据大屏',
|
||||
// icon: 'data-analysis',
|
||||
// defaultMenu: true
|
||||
// },
|
||||
// component: () => import('@/view/largeScreen2/index.vue')
|
||||
// })
|
||||
toRegister.push(...layoutRoute.children)
|
||||
}
|
||||
if (baseRouters.length > 1) {
|
||||
|
||||
103
src/view/equipment/list/index.vue
Normal file
103
src/view/equipment/list/index.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <warning-bar title="注:右上角头像下拉可切换角色" /> -->
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="searchForm" :inline="true" :model="searchInfo">
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="searchInfo.username" placeholder="用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称">
|
||||
<el-input v-model="searchInfo.nickname" placeholder="昵称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit"> 查询 </el-button>
|
||||
<el-button icon="refresh" @click="onReset"> 重置 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="addUser">新增用户</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" row-key="ID">
|
||||
<el-table-column align="left" label="头像" min-width="75">
|
||||
<template #default="scope">
|
||||
<CustomPic style="margin-top: 8px" :pic-src="scope.row.headerImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="ID" min-width="50" prop="ID" />
|
||||
<el-table-column align="left" label="用户名" min-width="150" prop="userName" />
|
||||
<el-table-column align="left" label="昵称" min-width="150" prop="nickName" />
|
||||
<el-table-column align="left" label="手机号" min-width="180" prop="phone" />
|
||||
<el-table-column align="left" label="邮箱" min-width="180" prop="email" />
|
||||
|
||||
<el-table-column label="操作" :min-width="appStore.operateMinWith" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link icon="delete" @click="deleteUserFunc(scope.row)">删除</el-button>
|
||||
<el-button type="primary" link icon="edit" @click="openEdit(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination
|
||||
:current-page="page"
|
||||
:page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getUserList, setUserAuthorities, register, deleteUser } from '@/api/user'
|
||||
|
||||
import { getAuthorityList } from '@/api/authority'
|
||||
import CustomPic from '@/components/customPic/index.vue'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { setUserInfo, resetPassword } from '@/api/user.js'
|
||||
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||
import { useAppStore } from '@/pinia'
|
||||
|
||||
defineOptions({
|
||||
name: 'User'
|
||||
})
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const searchInfo = ref({
|
||||
username: '',
|
||||
nickname: '',
|
||||
phone: '',
|
||||
email: ''
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
page.value = 1
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const onReset = () => {
|
||||
searchInfo.value = {
|
||||
username: '',
|
||||
nickname: '',
|
||||
phone: '',
|
||||
email: ''
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.header-img-box {
|
||||
@apply w-52 h-52 border border-solid border-gray-300 rounded-xl flex justify-center items-center cursor-pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -4,24 +4,17 @@
|
||||
class="rounded-lg flex items-center justify-evenly w-full h-full md:w-screen md:h-screen md:bg-[#194bfb] bg-white"
|
||||
>
|
||||
<div class="md:w-3/5 w-10/12 h-full flex items-center justify-evenly">
|
||||
<div
|
||||
class="oblique h-[130%] w-3/5 bg-white dark:bg-slate-900 transform -rotate-12 absolute -ml-52"
|
||||
/>
|
||||
<div class="oblique h-[130%] w-3/5 bg-white dark:bg-slate-900 transform -rotate-12 absolute -ml-52" />
|
||||
<!-- 分割斜块 -->
|
||||
<div
|
||||
class="z-[999] pt-12 pb-10 md:w-96 w-full rounded-lg flex flex-col justify-between box-border"
|
||||
>
|
||||
<div class="z-[999] pt-12 pb-10 md:w-96 w-full rounded-lg flex flex-col justify-between box-border">
|
||||
<div>
|
||||
<div class="flex items-center justify-center">
|
||||
<!-- <div class="flex items-center justify-center">
|
||||
<Logo :size="6" />
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="mb-9">
|
||||
<p class="text-center text-4xl font-bold">
|
||||
{{ $GIN_VUE_ADMIN.appName }}
|
||||
</p>
|
||||
<p class="text-center text-sm font-normal text-gray-500 mt-2.5">
|
||||
A management platform using Golang and Vue
|
||||
</p>
|
||||
</div>
|
||||
<el-form
|
||||
ref="loginForm"
|
||||
@@ -31,12 +24,7 @@
|
||||
@keyup.enter="submitForm"
|
||||
>
|
||||
<el-form-item prop="username" class="mb-6">
|
||||
<el-input
|
||||
v-model="loginFormData.username"
|
||||
size="large"
|
||||
placeholder="请输入用户名"
|
||||
suffix-icon="user"
|
||||
/>
|
||||
<el-input v-model="loginFormData.username" size="large" placeholder="请输入用户名" suffix-icon="user" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" class="mb-6">
|
||||
<el-input
|
||||
@@ -47,11 +35,7 @@
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="loginFormData.openCaptcha"
|
||||
prop="captcha"
|
||||
class="mb-6"
|
||||
>
|
||||
<el-form-item v-if="loginFormData.openCaptcha" prop="captcha" class="mb-6">
|
||||
<div class="flex w-full justify-between">
|
||||
<el-input
|
||||
v-model="loginFormData.captcha"
|
||||
@@ -71,15 +55,11 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item class="mb-6">
|
||||
<el-button
|
||||
class="shadow shadow-active h-11 w-full"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="submitForm"
|
||||
<el-button class="shadow shadow-active h-11 w-full" type="primary" size="large" @click="submitForm"
|
||||
>登 录</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item class="mb-6">
|
||||
<!-- <el-form-item class="mb-6">
|
||||
<el-button
|
||||
class="shadow shadow-active h-11 w-full"
|
||||
type="primary"
|
||||
@@ -87,21 +67,17 @@
|
||||
@click="checkInit"
|
||||
>前往初始化</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:block w-1/2 h-full float-right bg-[#194bfb]">
|
||||
<img
|
||||
class="h-full"
|
||||
src="@/assets/login_right_banner.jpg"
|
||||
alt="banner"
|
||||
/>
|
||||
<img class="h-full" src="@/assets/new-background.jpg" alt="banner" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BottomInfo class="left-0 right-0 absolute bottom-3 mx-auto w-full z-20">
|
||||
<!-- <BottomInfo class="left-0 right-0 absolute bottom-3 mx-auto w-full z-20">
|
||||
<div class="links items-center justify-center gap-2 hidden md:flex">
|
||||
<a href="https://www.gin-vue-admin.com/" target="_blank">
|
||||
<img src="@/assets/docs.png" class="w-8 h-8" alt="文档" />
|
||||
@@ -109,17 +85,14 @@
|
||||
<a href="https://support.qq.com/product/371961" target="_blank">
|
||||
<img src="@/assets/kefu.png" class="w-8 h-8" alt="客服" />
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/flipped-aurora/gin-vue-admin"
|
||||
target="_blank"
|
||||
>
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin" target="_blank">
|
||||
<img src="@/assets/github.png" class="w-8 h-8" alt="github" />
|
||||
</a>
|
||||
<a href="https://space.bilibili.com/322210472" target="_blank">
|
||||
<img src="@/assets/video.png" class="w-8 h-8" alt="视频站" />
|
||||
</a>
|
||||
</div>
|
||||
</BottomInfo>
|
||||
</BottomInfo> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -166,9 +139,7 @@
|
||||
return callback(new Error('验证码须为数字'))
|
||||
}
|
||||
if (sanitizedValue.length < captchaRequiredLength.value) {
|
||||
return callback(
|
||||
new Error(`请输入至少${captchaRequiredLength.value}位数字验证码`)
|
||||
)
|
||||
return callback(new Error(`请输入至少${captchaRequiredLength.value}位数字验证码`))
|
||||
}
|
||||
if (sanitizedValue !== value) {
|
||||
loginFormData.captcha = sanitizedValue
|
||||
|
||||
@@ -16,18 +16,14 @@
|
||||
<el-input v-model="searchInfo.email" placeholder="邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button type="primary" icon="search" @click="onSubmit"> 查询 </el-button>
|
||||
<el-button icon="refresh" @click="onReset"> 重置 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="addUser"
|
||||
>新增用户</el-button
|
||||
>
|
||||
<el-button type="primary" icon="plus" @click="addUser">新增用户</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" row-key="ID">
|
||||
<el-table-column align="left" label="头像" min-width="75">
|
||||
@@ -36,30 +32,10 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="ID" min-width="50" prop="ID" />
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="用户名"
|
||||
min-width="150"
|
||||
prop="userName"
|
||||
/>
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="昵称"
|
||||
min-width="150"
|
||||
prop="nickName"
|
||||
/>
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="手机号"
|
||||
min-width="180"
|
||||
prop="phone"
|
||||
/>
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="邮箱"
|
||||
min-width="180"
|
||||
prop="email"
|
||||
/>
|
||||
<el-table-column align="left" label="用户名" min-width="150" prop="userName" />
|
||||
<el-table-column align="left" label="昵称" min-width="150" prop="nickName" />
|
||||
<el-table-column align="left" label="手机号" min-width="180" prop="phone" />
|
||||
<el-table-column align="left" label="邮箱" min-width="180" prop="email" />
|
||||
<el-table-column align="left" label="用户角色" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-cascader
|
||||
@@ -107,27 +83,9 @@
|
||||
|
||||
<el-table-column label="操作" :min-width="appStore.operateMinWith" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="delete"
|
||||
@click="deleteUserFunc(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="edit"
|
||||
@click="openEdit(scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="magic-stick"
|
||||
@click="resetPasswordFunc(scope.row)"
|
||||
>重置密码</el-button
|
||||
>
|
||||
<el-button type="primary" link icon="delete" @click="deleteUserFunc(scope.row)">删除</el-button>
|
||||
<el-button type="primary" link icon="edit" @click="openEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="primary" link icon="magic-stick" @click="resetPasswordFunc(scope.row)">重置密码</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -174,7 +132,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-drawer
|
||||
v-model="addUserDialog"
|
||||
:size="appStore.drawerSize"
|
||||
@@ -187,24 +145,13 @@
|
||||
<span class="text-lg">用户</span>
|
||||
<div>
|
||||
<el-button @click="closeAddUserDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="enterAddUserDialog"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button type="primary" @click="enterAddUserDialog">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form
|
||||
ref="userForm"
|
||||
:rules="rules"
|
||||
:model="userInfo"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item
|
||||
v-if="dialogFlag === 'add'"
|
||||
label="用户名"
|
||||
prop="userName"
|
||||
>
|
||||
<el-form ref="userForm" :rules="rules" :model="userInfo" label-width="80px">
|
||||
<el-form-item v-if="dialogFlag === 'add'" label="用户名" prop="userName">
|
||||
<el-input v-model="userInfo.userName" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="dialogFlag === 'add'" label="密码" prop="password">
|
||||
@@ -237,12 +184,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用" prop="disabled">
|
||||
<el-switch
|
||||
v-model="userInfo.enable"
|
||||
inline-prompt
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
/>
|
||||
<el-switch v-model="userInfo.enable" inline-prompt :active-value="1" :inactive-value="2" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像" label-width="80px">
|
||||
<SelectImage v-model="userInfo.headerImg" />
|
||||
@@ -253,12 +195,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
getUserList,
|
||||
setUserAuthorities,
|
||||
register,
|
||||
deleteUser
|
||||
} from '@/api/user'
|
||||
import { getUserList, setUserAuthorities, register, deleteUser } from '@/api/user'
|
||||
|
||||
import { getAuthorityList } from '@/api/authority'
|
||||
import CustomPic from '@/components/customPic/index.vue'
|
||||
@@ -268,7 +205,7 @@
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||
import { useAppStore } from "@/pinia";
|
||||
import { useAppStore } from '@/pinia'
|
||||
|
||||
defineOptions({
|
||||
name: 'User'
|
||||
@@ -373,7 +310,7 @@
|
||||
nickName: '',
|
||||
password: ''
|
||||
})
|
||||
|
||||
|
||||
// 生成随机密码
|
||||
const generateRandomPassword = () => {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'
|
||||
@@ -383,19 +320,22 @@
|
||||
}
|
||||
resetPwdInfo.value.password = password
|
||||
// 复制到剪贴板
|
||||
navigator.clipboard.writeText(password).then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '密码已复制到剪贴板'
|
||||
navigator.clipboard
|
||||
.writeText(password)
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '密码已复制到剪贴板'
|
||||
})
|
||||
})
|
||||
}).catch(() => {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '复制失败,请手动复制'
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '复制失败,请手动复制'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 打开重置密码对话框
|
||||
const resetPasswordFunc = (row) => {
|
||||
resetPwdInfo.value.ID = row.ID
|
||||
@@ -404,7 +344,7 @@
|
||||
resetPwdInfo.value.password = ''
|
||||
resetPwdDialog.value = true
|
||||
}
|
||||
|
||||
|
||||
// 确认重置密码
|
||||
const confirmResetPassword = async () => {
|
||||
if (!resetPwdInfo.value.password) {
|
||||
@@ -414,12 +354,12 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
const res = await resetPassword({
|
||||
ID: resetPwdInfo.value.ID,
|
||||
password: resetPwdInfo.value.password
|
||||
})
|
||||
|
||||
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
@@ -433,7 +373,7 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 关闭重置密码对话框
|
||||
const closeResetPwdDialog = () => {
|
||||
resetPwdInfo.value.password = ''
|
||||
@@ -505,9 +445,7 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
authorityId: [
|
||||
{ required: true, message: '请选择用户角色', trigger: 'blur' }
|
||||
]
|
||||
authorityId: [{ required: true, message: '请选择用户角色', trigger: 'blur' }]
|
||||
})
|
||||
const userForm = ref(null)
|
||||
const enterAddUserDialog = async () => {
|
||||
|
||||
Reference in New Issue
Block a user