Translate the oidc login view

This commit is contained in:
Johannes Zellner
2023-06-19 11:50:53 +02:00
parent fd91bf0498
commit 35453a0c2d
2 changed files with 17 additions and 11 deletions
+10 -10
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<title>Login to <%= name %></title>
<title>{{ login.loginTo }} <%= name %></title>
<link id="favicon" type="image/png" rel="icon" href="/api/v1/cloudron/avatar">
<link rel="apple-touch-icon" href="/api/v1/cloudron/avatar">
@@ -59,7 +59,7 @@
<div class="col-md-12" style="text-align: center;">
<img width="128" height="128" class="avatar" src="<%= iconUrl %>"/>
<br/>
<h1><small>Login to</small> <%= name %></h1>
<h1><small>{{ login.loginTo }}</small> <%= name %></h1>
</div>
</div>
<br/>
@@ -67,21 +67,21 @@
<div class="col-md-12">
<form id="loginForm">
<div class="form-group">
<label class="control-label" for="inputUsername">Username</label>
<label class="control-label" for="inputUsername">{{ login.username }}</label>
<input type="text" class="form-control" id="inputUsername" name="username" autofocus required>
</div>
<div class="form-group">
<label class="control-label" for="inputPassword">Password</label>
<label class="control-label" for="inputPassword">{{ login.password }}</label>
<input type="password" class="form-control" name="password" id="inputPassword" required password-reveal>
<p class="has-error" id="passwordError"></p>
</div>
<div class="form-group">
<label class="control-label" for="inputTotpToken">2FA Token (if enabled)</label>
<label class="control-label" for="inputTotpToken">{{ login.2faToken }}</label>
<input type="text" class="form-control" name="totpToken" id="inputTotpToken" value="">
<p class="has-error" id="totpError"></p>
</div>
<a href="/passwordreset.html">Reset password</a>
<button class="btn btn-primary btn-outline pull-right" type="submit">Log in</button>
<a href="/passwordreset.html">{{ login.resetPasswordAction }}</a>
<button class="btn btn-primary btn-outline pull-right" type="submit">{{ login.signInAction }}</button>
</form>
</div>
</div>
@@ -119,11 +119,11 @@ document.getElementById('loginForm').addEventListener('submit', function (event)
if (data.message === 'Username and password does not match') {
document.getElementById('inputPassword').value = '';
document.getElementById('inputPassword').focus();
document.getElementById('passwordError').innerText = 'Invalid username or password';
document.getElementById('passwordError').innerText = '{{ login.errorIncorrectCredentials }}';
} else if (data.message.indexOf('totpToken') !== -1) {
document.getElementById('inputTotpToken').value = '';
document.getElementById('inputTotpToken').focus();
document.getElementById('totpError').innerText = 'Missing or invalid 2FA Token';
document.getElementById('totpError').innerText = '{{ login.errorIncorrect2FAToken }}';
} else {
throw new Error('Something went wrong');
}
@@ -134,7 +134,7 @@ document.getElementById('loginForm').addEventListener('submit', function (event)
if (data.redirectTo) window.location.href = data.redirectTo;
else console.log('login success but missing redirectTo in data:', data);
}).catch(function (error) {
document.getElementById('passwordError').innerText = 'Unexpected error. Try again later.';
document.getElementById('passwordError').innerText = '{{ login.errorInternal }}';
console.warn(error, res);
});
});