-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgot-password.html
178 lines (159 loc) · 8.31 KB
/
forgot-password.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Recuperação de conta</title>
<!-- CSS -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" />
<link href="https://res.cloudinary.com/finnhvman/raw/upload/matter/matter-0.2.2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/incentive-me/[email protected]/css/base.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/incentive-me/[email protected]/css/register.min.css"/>
<!-- <link rel="stylesheet" href="/css/base.css"/> -->
<!-- <link rel="stylesheet" href="/css/register.css"/> -->
<!-- Favicon and touch icons -->
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/incentive-me/cdn/favicon.ico" />
</head>
<body>
<div class="container">
<div class="form" th:if="${error == null && success == null}">
<div class="progress"><progress id="progress" class="matter-progress-linear" style="visibility: hidden;"></progress></div>
<div id="after-progress">
<div class="logo-title">
<img class="logo" src="https://www.incentive.me/images/logo.svg" />
<div class="form-title">
<label>Recuperação de conta</label>
<span>Um e-mail será enviado com instruções para criação de uma nova senha</span>
</div>
</div>
<div class="form-row" style="margin-top: 0px;">
<form role="form" th:action="${action}" method="post" onsubmit="register(event)">
<div class="form-content">
<div class="form-row">
<label class="matter-textfield-outlined">
<input type="email" id="email" name="email" required placeholder=" " autocomplete="email" pattern="^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$"/>
<span>E-mail</span>
</label>
</div>
<div id="email-info" class="input-helper">
<svg aria-hidden="true" style="flex-shrink: 0;margin-right: 5px;" fill="currentColor" focusable="false" width="16px" height="16px" viewBox="0 0 24 24">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"></path>
</svg>
Informe o e-mail utilizado no cadastro
</div>
</div>
<input type="hidden" id="username" name="username" value="" />
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
<input type="hidden" th:name="client_id" th:value="${param.client_id}" />
<div id="error-container" class="error-info error" style="display: none;">
<svg aria-hidden="true" style="flex-shrink: 0;margin-right: 5px;" fill="currentColor" focusable="false" width="16px" height="16px" viewBox="0 0 24 24">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path>
</svg>
<p style="margin: 0; display: none;" id="invalid_password_value">
Senha inválida. Use oito ou mais caracteres com uma combinação de letras maiúsculas e minúsculas, números e símbolos.
</p>
<p style="margin: 0; display: none;" id="invalid_user_information">
Nome ou sobrenome inválido.
</p>
<p style="margin: 0; display: none;" id="invalid_email">
E-mail inválido.
</p>
<p style="margin: 0; display: none;" id="invalid_other">
Alguma informação está faltando ou é inválida.
</p>
<p style="margin: 0; display: none;" id="error_description"></p>
</div>
<div class="form-row">
<button type="button" class="matter-button-text matter-secondary" th:onclick="location.href=[[${loginAction}]];setLoading(true);">Voltar para o login</button>
<span style="display: flex; flex: 1;"></span>
<button type="submit" class="matter-button-contained">Continuar</button>
</div>
</form>
<img src="https://www.incentive.me/images/rede1.png" class="decoration" style="margin-left: 40px;" />
</div>
</div>
</div>
<div th:if="${success}" class="form">
<div class="form-title">
<label>Verifique sua caixa de entrada</label>
<p>
Procure um e-mail com o título <strong>"Recuperar conta Incentive.me"</strong> e siga as instruções para criar uma nova senha.
<br/><br/>
<small>Caso não encontre o e-mail, é possível que você ainda não tenha um cadastro, tente realizar um cadastro.</small>
</p>
</div>
<div class="form-row">
<span style="display: flex; flex: 1"></span>
<button type="button" class="matter-button-contained" th:onclick="location.href=[[${loginAction}]]">Fazer login</button>
</div>
</div>
<div th:if="${error}" class="form">
<div class="form-title">
<label>Erro na recuperação de conta</label>
<p>Por favor, tente novamente ou entre em contato solicitando ajuda.</p>
</div>
<div class="error-info">
Detalhe do erro:
<span th:text="*{error_description}?: ${error}" class="error"></span>
</div>
<div class="form-row">
<span style="display: flex; flex: 1;"></span>
<button type="button" class="matter-button-contained" th:onclick="location.href=[[${loginAction}]]">Tentar novamente</button>
</div>
</div>
<footer>
<ul class="footer-buttons">
<li><a href="http://ajuda.incentive.me" target="_blank">Ajuda</a></li>
<li><a href="https://policies.incentive.me/privacy" target="_blank">Privacidade</a></li>
<li><a href="https://policies.incentive.me/tos" target="_blank">Termos</a></li>
</ul>
</footer>
</div>
<script defer src="https://cdn.jsdelivr.net/gh/incentive-me/[email protected]/js/base.min.js"></script>
<script>
var errorContainer, errorDetail;
function register(e) {
setLoading(true);
e.preventDefault();
if (errorContainer) {
errorContainer.style.display = 'none';
}
if (errorDetail) {
errorDetail.style.display = 'none';
}
var request = new XMLHttpRequest();
request.onload = function () {
const urlParams = new URLSearchParams(request.responseURL.split('?')[1]);
var returnObject = Object.fromEntries(urlParams.entries());
// console.log(returnObject);
var span = document.createElement('span');
span.innerHTML = request.response;
const newXSRFToken = span.querySelector('input[name="X-XSRF-TOKEN"]')
if (newXSRFToken) {
document.querySelector('input[name="X-XSRF-TOKEN"]').value = newXSRFToken.value;
if (returnObject.warning || returnObject.error) {
errorContainer = document.getElementById('error-container');
errorDetail = document.getElementById(returnObject.warning);
if (!errorDetail) {
errorDetail = document.getElementById('invalid_other');
if (returnObject.error_description) {
errorDetail = document.getElementById('error_description');
errorDetail.innerText = returnObject.error_description;
}
}
errorContainer.style.display = 'flex';
errorDetail.style.display = 'block';
setLoading(false);
}
} else {
document.location = request.responseURL;
}
}
request.open("POST", e.target.action);
request.send(new FormData(e.target));
}
</script>
</body>
</html>