Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class LoginPage extends LanguageComboboxAwarePage {
@ArquillianResource
protected OAuthClient oauth;

@FindBy(xpath = "//html")
protected WebElement htmlRoot;

@FindBy(id = "username")
protected WebElement usernameInput;

Expand Down Expand Up @@ -68,7 +71,6 @@ public class LoginPage extends LanguageComboboxAwarePage {
@FindBy(className = "alert-success")
private WebElement loginSuccessMessage;


@FindBy(className = "alert-info")
private WebElement loginInfoMessage;

Expand Down Expand Up @@ -109,12 +111,15 @@ public void missingPassword(String username) {
usernameInput.sendKeys(username);
passwordInput.clear();
clickLink(submitButton);

}

public void missingUsername() {
clearUsernameInputAndWaitIfNecessary();
clickLink(submitButton);
}

public String getHtmlLanguage() {
return htmlRoot.getAttribute("lang");
}

public String getUsername() {
Expand Down Expand Up @@ -168,6 +173,7 @@ public String getInstruction() {
public String getSuccessMessage() {
return loginSuccessMessage != null ? loginSuccessMessage.getText() : null;
}

public String getInfoMessage() {
try {
return getTextFromElement(loginInfoMessage);
Expand All @@ -176,7 +182,6 @@ public String getInfoMessage() {
}
}


public boolean isCurrent() {
String realm = "test";
return isCurrent(realm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ public void uiLocalesParameter() {
assertEquals("Deutsch", loginPage.getLanguageDropdownText());
}

@Test
public void htmlLangAttribute() {
loginPage.open();
assertEquals("en", loginPage.getHtmlLanguage());

oauth.uiLocales("de");
loginPage.open();
assertEquals("de", loginPage.getHtmlLanguage());
}

@Test
public void acceptLanguageHeader() throws IOException {
try(CloseableHttpClient httpClient = (CloseableHttpClient) new HttpClientBuilder().build()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#macro mainLayout active bodyClass>
<!doctype html>
<html>
<html<#if realm.internationalizationEnabled> lang="${locale.currentLanguageTag}"</#if>>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion themes/src/main/resources/theme/base/login/template.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#macro registrationLayout bodyClass="" displayInfo=false displayMessage=true displayRequiredFields=false>
<!DOCTYPE html>
<html class="${properties.kcHtmlClass!}">
<html class="${properties.kcHtmlClass!}"<#if realm.internationalizationEnabled> lang="${locale.currentLanguageTag}"</#if>>

<head>
<meta charset="utf-8">
Expand Down