feat: 增加首次进入系统强制修改用户密码功能(#3)
This commit is contained in:
parent
553af5f783
commit
39f573610d
@ -418,7 +418,8 @@ class UserProfile(ApiMixin):
|
|||||||
permission_list = get_user_dynamics_permission(str(user.id))
|
permission_list = get_user_dynamics_permission(str(user.id))
|
||||||
permission_list += [p.value for p in get_permission_list_by_role(RoleConstants[user.role])]
|
permission_list += [p.value for p in get_permission_list_by_role(RoleConstants[user.role])]
|
||||||
return {'id': user.id, 'username': user.username, 'email': user.email, 'role': user.role,
|
return {'id': user.id, 'username': user.username, 'email': user.email, 'role': user.role,
|
||||||
'permissions': [str(p) for p in permission_list]}
|
'permissions': [str(p) for p in permission_list],
|
||||||
|
'is_edit_password': user.password == 'd880e722c47a34d8e9fce789fc62389d' if user.role == 'ADMIN' else False}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_response_body_api():
|
def get_response_body_api():
|
||||||
|
|||||||
@ -19,6 +19,10 @@ interface User {
|
|||||||
* 用户权限
|
* 用户权限
|
||||||
*/
|
*/
|
||||||
permissions: Array<string>
|
permissions: Array<string>
|
||||||
|
/**
|
||||||
|
* 是否需要修改密码
|
||||||
|
*/
|
||||||
|
is_edit_password?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LoginRequest {
|
interface LoginRequest {
|
||||||
|
|||||||
@ -30,16 +30,19 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
||||||
<AboutDialog ref="AboutDialogRef"></AboutDialog>
|
<AboutDialog ref="AboutDialogRef"></AboutDialog>
|
||||||
|
<UserPwdDialog ref="UserPwdDialogRef" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import ResetPassword from './ResetPassword.vue'
|
import ResetPassword from './ResetPassword.vue'
|
||||||
import AboutDialog from './AboutDialog.vue'
|
import AboutDialog from './AboutDialog.vue'
|
||||||
|
import UserPwdDialog from '@/views/user-manage/component/UserPwdDialog.vue'
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const UserPwdDialogRef = ref()
|
||||||
const AboutDialogRef = ref()
|
const AboutDialogRef = ref()
|
||||||
const resetPasswordRef = ref<InstanceType<typeof ResetPassword>>()
|
const resetPasswordRef = ref<InstanceType<typeof ResetPassword>>()
|
||||||
|
|
||||||
@ -56,6 +59,12 @@ const logout = () => {
|
|||||||
router.push({ name: 'login' })
|
router.push({ name: 'login' })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (user.userInfo?.is_edit_password) {
|
||||||
|
UserPwdDialogRef.value.open(user.userInfo)
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.avatar-dropdown {
|
.avatar-dropdown {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user