Search in sources :

Example 1 with LoginPrefs

use of com.faforever.client.preferences.LoginPrefs in project downlords-faf-client by FAForever.

the class ServerAccessorImplTest method setUp.

@Before
public void setUp() throws Exception {
    serverToClientReadyLatch = new CountDownLatch(1);
    messagesReceivedByFafServer = new ArrayBlockingQueue<>(10);
    startFakeFafLobbyServer();
    ClientProperties clientProperties = new ClientProperties();
    clientProperties.getServer().setHost(LOOPBACK_ADDRESS.getHostAddress()).setPort(fafLobbyServerSocket.getLocalPort());
    instance = new FafServerAccessorImpl(preferencesService, uidService, notificationService, i18n, clientProperties, reportingService);
    LoginPrefs loginPrefs = new LoginPrefs();
    loginPrefs.setUsername("junit");
    loginPrefs.setPassword("password");
    when(preferencesService.getFafDataDirectory()).thenReturn(faDirectory.getRoot().toPath());
    when(uidService.generate(any(), any())).thenReturn("encrypteduidstring");
}
Also used : ClientProperties(com.faforever.client.config.ClientProperties) LoginPrefs(com.faforever.client.preferences.LoginPrefs) CountDownLatch(java.util.concurrent.CountDownLatch) Before(org.junit.Before)

Example 2 with LoginPrefs

use of com.faforever.client.preferences.LoginPrefs in project downlords-faf-client by FAForever.

the class LoginController method display.

public void display() {
    setShowLoginProgress(false);
    LoginPrefs loginPrefs = preferencesService.getPreferences().getLogin();
    String username = loginPrefs.getUsername();
    String password = loginPrefs.getPassword();
    boolean isAutoLogin = loginPrefs.getAutoLogin();
    // Fill the form even if autoLogin is true, since user may cancel the login
    usernameInput.setText(Strings.nullToEmpty(username));
    autoLoginCheckBox.setSelected(isAutoLogin);
    if (loginPrefs.getAutoLogin() && !isNullOrEmpty(username) && !isNullOrEmpty(password)) {
        login(username, password, true);
    } else if (isNullOrEmpty(username)) {
        usernameInput.requestFocus();
    } else {
        passwordInput.requestFocus();
    }
}
Also used : LoginPrefs(com.faforever.client.preferences.LoginPrefs)

Aggregations

LoginPrefs (com.faforever.client.preferences.LoginPrefs)2 ClientProperties (com.faforever.client.config.ClientProperties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Before (org.junit.Before)1