Schafkopf-Server/Public/recovery.html

57 lines
1.8 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>Schafkopf</title>
<meta name='viewport' content='width=device-width, initial-scale=1'/>
<link rel='stylesheet' type='text/css' href='style.css'/>
<link rel='stylesheet' type='text/css' href='login.css'/>
<script src='api.js'></script>
<script src='login.js'></script>
</head>
<body>
<div id="login-window">
<div id="login-window-vertical-center">
<div id="login-window-inner">
<div id="sheephead-logo">\_______/<br>\ - - /<br>\ | /<br>\_/<br><br>Sheephead</div>
<label for="psw">New Password</label>
<input type="password" id="user-pwd" name="psw" required>
<button class="login-buttons standard-button" onclick="resetPassword()">Set new password</button>
<div id="user-hint"></div>
</div>
</div>
</div>
<script>
function resetPassword() {
const password = getLoginPassword()
if (password == "") {
setTextHint("Please enter a password")
return
}
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if (!urlParams.has('token')) {
setTextHint("Please open a valid recovery link")
return
}
const token = urlParams.get('token');
if (token == "") {
setTextHint("Please open a valid recovery link")
return
}
performResetPasswordRequest(token, password)
.then(function(value) {
window.location.href = "login.html"
})
.catch(setTextHint)
}
</script>
</body>
</html>