mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
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 += [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,
|
||||
'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
|
||||
def get_response_body_api():
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ interface User {
|
|||
* 用户权限
|
||||
*/
|
||||
permissions: Array<string>
|
||||
/**
|
||||
* 是否需要修改密码
|
||||
*/
|
||||
is_edit_password?: boolean
|
||||
}
|
||||
|
||||
interface LoginRequest {
|
||||
|
|
|
|||
|
|
@ -30,16 +30,19 @@
|
|||
</el-dropdown>
|
||||
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
||||
<AboutDialog ref="AboutDialogRef"></AboutDialog>
|
||||
<UserPwdDialog ref="UserPwdDialogRef" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import useStore from '@/stores'
|
||||
import { useRouter } from 'vue-router'
|
||||
import ResetPassword from './ResetPassword.vue'
|
||||
import AboutDialog from './AboutDialog.vue'
|
||||
import UserPwdDialog from '@/views/user-manage/component/UserPwdDialog.vue'
|
||||
const { user } = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
const UserPwdDialogRef = ref()
|
||||
const AboutDialogRef = ref()
|
||||
const resetPasswordRef = ref<InstanceType<typeof ResetPassword>>()
|
||||
|
||||
|
|
@ -56,6 +59,12 @@ const logout = () => {
|
|||
router.push({ name: 'login' })
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (user.userInfo?.is_edit_password) {
|
||||
UserPwdDialogRef.value.open(user.userInfo)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.avatar-dropdown {
|
||||
|
|
|
|||
Loading…
Reference in New Issue