Skip to content

Commit 39b6c31

Browse files
committed
FIX: Corrigindo problemas na acesso ao editor
1 parent 7ba293c commit 39b6c31

1 file changed

Lines changed: 37 additions & 18 deletions

File tree

minervacore/src/pages/editor.js

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const LoginScreen = ({ onLogin, adminPass }) => {
1717
const [token, setToken] = useState('');
1818
const [remember, setRemember] = useState(false); // Estado para lembrar o token
1919
const [error, setError] = useState('');
20+
const [showPass, setShowPass] = useState(false);
2021

2122
// URL para gerar um novo token no GitHub já preenchido com as permissões necessárias
2223
const generateTokenUrl = "https://github.com/settings/tokens/new?description=MinervaCore+Editor+Access&scopes=repo";
@@ -61,25 +62,44 @@ const LoginScreen = ({ onLogin, adminPass }) => {
6162
<p style={{opacity: 0.7, fontSize: '0.9rem'}}>Área administrativa para gestão de conteúdo</p>
6263
</div>
6364

64-
{/* Formulário */}
65-
<form onSubmit={handleSubmit}>
65+
<form onSubmit={handleSubmit} autoComplete="off">
6666

6767
{/* Senha da Equipe */}
6868
<div className="margin-bottom--md">
6969
<label htmlFor="team-pass" style={{fontWeight: 'bold', display: 'block', marginBottom: '5px'}}>
7070
Senha da Equipe
7171
</label>
72-
<input
73-
id="team-pass"
74-
name="team-password" // Ajuda o navegador a salvar corretamente
75-
type="password"
76-
className="button button--block button--outline button--secondary"
77-
style={{textAlign: 'left', cursor: 'text'}}
78-
placeholder="••••••••"
79-
value={pass}
80-
onChange={e => setPass(e.target.value)}
81-
autoComplete="current-password"
82-
/>
72+
<div style={{position: 'relative'}}>
73+
<input
74+
id="mc_access_key_field"
75+
name="mc_access_key_no_autofill"
76+
type={showPass ? "text" : "password"}
77+
className="button button--block button--outline button--secondary"
78+
style={{textAlign: 'left', cursor: 'text', paddingRight: '40px'}}
79+
placeholder="••••••••"
80+
value={pass}
81+
onChange={e => setPass(e.target.value)}
82+
autoComplete="new-password"
83+
/>
84+
<button
85+
type="button"
86+
onClick={() => setShowPass(!showPass)}
87+
style={{
88+
position: 'absolute',
89+
right: '10px',
90+
top: '50%',
91+
transform: 'translateY(-50%)',
92+
background: 'none',
93+
border: 'none',
94+
cursor: 'pointer',
95+
opacity: 0.6,
96+
padding: '5px'
97+
}}
98+
title={showPass ? "Ocultar senha" : "Mostrar senha"}
99+
>
100+
{showPass ? "🙈" : "👁️"}
101+
</button>
102+
</div>
83103
</div>
84104

85105
{/* Token do GitHub */}
@@ -92,22 +112,21 @@ const LoginScreen = ({ onLogin, adminPass }) => {
92112
</div>
93113

94114
<input
95-
id="gh-token"
96-
name="github-token" // Nome diferente para não confundir com senha
115+
id="mc_gh_token_field"
116+
name="mc_gh_token_no_autofill"
97117
type="password"
98118
className="button button--block button--outline button--secondary"
99119
style={{textAlign: 'left', cursor: 'text', fontFamily: 'monospace'}}
100120
placeholder="ghp_..."
101121
value={token}
102122
onChange={e => setToken(e.target.value)}
103-
autoComplete="off" // Tenta evitar que o navegador sobrescreva a senha da equipe
123+
autoComplete="new-password"
104124
/>
105125
<small style={{fontSize: '0.75rem', opacity: 0.6, marginTop: '4px', display: 'block'}}>
106126
Necessário permissão de <code>repo</code> para editar arquivos.
107127
</small>
108128
</div>
109129

110-
{/* Opções Extras */}
111130
<div className="margin-bottom--lg" style={{display: 'flex', alignItems: 'center'}}>
112131
<input
113132
type="checkbox"
@@ -124,7 +143,7 @@ const LoginScreen = ({ onLogin, adminPass }) => {
124143
{/* Erros */}
125144
{error && (
126145
<div className="alert alert--danger margin-bottom--md" role="alert">
127-
<i className="fas fa-exclamation-circle"></i> {error}
146+
{error}
128147
</div>
129148
)}
130149

0 commit comments

Comments
 (0)