Repository navigation
Expand file tree
/
Copy pathex25.html
More file actions
56 lines (48 loc) · 1.51 KB
/
Copy pathex25.html
File metadata and controls
56 lines (48 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Validação de Login com Retorno de Objeto </title>
<script src="ex25.js" defer></script>
</head>
<body>
<main>
<h1> Validação de Login com Retorno de Objeto </h1>
</main>
<script>
function validarAcesso(emailDigitado, senhaDigitada) {
const emailCorreto = "adm12@gmail.com";
const senhaCorreta = "124279";
if (emailDigitado === "" || senhaDigitada === "") {
return {
sucesso: false,
mensagem: "Preencha todos os campos"
};
}
if (emailDigitado !== emailCorreto) {
return {
sucesso: false,
mensagem: "Email inválido"
};
}
if (senhaDigitada !== senhaCorreta) {
return {
sucesso: false,
mensagem: "Senha inválida"
};
}
return {
sucesso: true,
mensagem: "Login realizado"
};
}
const resultado = validarAcesso("adm12@gmail.com", "124279");
if (resultado.sucesso === true) {
console.log("Entrar no sistema");
} else {
console.log(resultado.mensagem);
}
</script>
</body>
</html>