Cursor 点击login in 之后无反应

在保证网络没有问题的情况下,cursor点击 login in 无法自动打开浏览器的登录界面。

后来发现是之前下载夸克浏览器时,将默认浏览器进行了更改

卸载夸克浏览器之后,并未将默认设置调整为chrom。

导致现在系统的默认浏览器为空。

只需要在默认应用中的http和https中选择一个浏览器即可。

<template> <div class="login-type"> <ul> <li v-for="item in defaultType" :key="item.value" @click="$emit('change-type', item.value)"> <img :src="item.icon" alt="" /> <span> {{ $t(item.label) }} </span> </li> <li @click="$emit('openAuth-popup')"> <img src="https://qhstatic.kujiale.com/oauth2/images/logo_32.png " alt=""> <span> 酷家乐登录 </span> </li> </ul> </div> </template> <script setup> import icon_account from '@/assets/svg/login-type-account.svg'; import icon_code from '@/assets/svg/login-type-code.svg'; import icon_qrcode from '@/assets/svg/login-type-qrcode.svg'; import icon_register from '@/assets/svg/login-type-register.svg'; import { $t } from '@/utils/message/index'; const props = defineProps({ active: { type: String, default: '', }, }); const defaultType = [ { icon: icon_code, value: 'code', label: 'msgLoginList.verifyLogin', }, { icon: icon_account, value: 'account', label: 'msgLoginList.accountLogin', }, { icon: icon_register, value: 'register', label: 'msgLoginList.accountRegister', }, { icon: icon_qrcode, value: 'qrcode', label: 'msgLoginList.wechatLogin', }, ].filter((item) => item.value != props.active); </script> <style lang="scss" scoped> .login-type { width: 240px; height: 62px; margin-top: 16px; img { width: 36px; height: 36px; } ul { display: flex; align-items: center; gap: 24px; height: 100%; li { display: flex; align-items: center; flex-direction: column; justify-content: space-between; height: 100%; cursor: pointer; width: 48px; span { color: #8c93a4; font-size: 12px; white-space: nowrap; } } } } </style> <template> <div class="right-panel"> <component :is="ComponentList[name]" :key="name" @change-type="changeType" @openAuth-popup="openAuthPopup" @back="back" @success="success" /> <!-- <button @click="openAuthPopup" class="auth-btn">酷家乐登录</button> --> <!-- <iframe src="https://oauth.kujiale.com/oauth2/show?client_id=d5gzvQhhXUw39FYr&redirect_uri=http://localhost:8082/space/effect&response_type=code&state=%22sed%22&scope=get_user_info ,get_design,get_budget_list" frameborder="0" class="auth-iframe"></iframe> --> </div> </template> <script setup> import { ref, watch } from 'vue'; import ComponentList from '../views/index'; import { onMounted } from 'vue'; const emit = defineEmits(['success']); const name = ref('qrcode'); let lastName = ''; const changeType = (type) => { name.value = type; }; const back = () => { name.value = lastName || 'qrcode'; }; const success = () => { emit('success'); }; watch(name, (newVal, oldVal) => { if (newVal === 'register') { lastName = oldVal; } }); //kujiale test let authPopup = null; // 打开授权弹窗 const openAuthPopup = () => { // 计算弹窗位置(居中显示) const width = 500; const height = 600; const left = window.screen.width / 2 - width / 2; const top = window.screen.height / 2 - height / 2; // 授权URL(与之前一致) const authUrl = 'https://oauth.kujiale.com/oauth2/show?client_id=d5gzvQhhXUw39FYr&redirect_uri=http://localhost:8082/space/effect&response_type=code&state=sed&scope=get_user_info ,get_design,get_budget_list'; // 打开弹窗 authPopup = window.open( authUrl, 'KujialeAuth', // 弹窗名称 `width=${width},height=${height},left=${left},top=${top}` ); // 定时检查弹窗是否关闭(获取授权结果) const checkPopup = setInterval(() => { if (authPopup && authPopup.closed) { clearInterval(checkPopup); // 弹窗关闭后,可在这里触发主页面的登录状态刷新 emit('success'); } }, 500); }; // 监听弹窗发送的消息(关键:获取授权码) onMounted(() => { window.addEventListener('message', (event) => { // 验证消息来源(必须限制为授权回调页的域名,防止恶意攻击) if (event.origin !== 'http://localhost:8082') return; // 假设回调页授权成功后,通过postMessage发送code if (event.data.type === 'OAUTH_CODE') { const { code, state } = event.data; // 这里处理code(如传给后端换token) console.log('授权码:', code); // 关闭弹窗 if (authPopup && !authPopup.closed) authPopup.close(); // 通知登录成功 emit('success'); } }); }); </script> <style lang="scss" scoped> .right-panel { width: 425px; min-height: 485px; padding: 36px 24px 12px 24px; position: relative; background: #fff; z-index: 1; } </style> 为什么点击酷家乐登录没有反应,具体两个组件代码如上
10-25
### 关于CursorCode登录问题的解决方案 对于安装完成后,在登录CursorCode账号时遇到的问题,特别是在使用GitHub账号登录方面,可能的原因涉及多个层面的技术细节[^1]。 #### 可能原因分析 1. **OAuth配置错误** 如果CursorCode依赖GitHub OAuth进行身份验证,则可能是由于应用在GitHub上的OAuth回调URL配置不当造成的。这通常发生在本地开发环境与生产环境之间的切换过程中未更新相应的设置。 2. **浏览器缓存或Cookie问题** 浏览器中的旧版本数据可能导致认证流程失败。清除浏览器缓存和Cookies可以排除此类干扰因素。 3. **跨站请求伪造(CSRF)保护机制触发** 当网站启用了严格的CSRF防护措施而客户端未能正确处理Token传递时,也会阻止正常登录过程。 4. **网络连接不稳定** 不稳定的互联网连接同样会影响第三方服务(如GitHub)的身份验证响应时间,进而影响整个登录体验。 #### 解决方案建议 针对上述可能性,采取如下措施有助于解决问题: - 检查并确认应用程序在GitHub开发者控制台内的OAuth授权回调地址是否匹配当前部署环境。 - 清除浏览器的历史记录、缓存以及相关联的Cookies后再尝试重新启动登录操作。 - 查看是否有任何安全插件或防火墙规则阻碍了必要的HTTP(S)请求,并适当调整这些组件的行为。 - 对于特定情况下出现的CSRF Token失效情况,可考虑刷新页面获取新的令牌再继续登录动作。 - 确认网络状况良好,避免因临时性的网络波动引起的服务不可达现象。 值得注意的是,这里提到的内容主要围绕着通过GitHub账户登录CursorCode所面临的挑战展开讨论,并不涉及到`cursor:hand;`样式属性及其兼容性议题[^2],也不直接关联到更广泛的前端浏览器兼容性策略[^3]。
评论 10
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值