private static final String NAME_PARAM = "Name";
private static final String EMAIL_PARAM = "Email";
private static final Pattern START_WITH_SPECIFIC_AUTHORIZED_CHARACTERS = Pattern.compile("^[\\.\\-_@].*$");
- private static final Pattern CONTAINS_ONLY_AUTHORIZED_CHARACTERS = Pattern.compile("\\A\\w[\\w\\.\\-_@]+\\z");
+ private static final Pattern CONTAINS_ONLY_AUTHORIZED_CHARACTERS = Pattern.compile("\\A\\w[\\w\\.\\-@]+\\z");
public static final int LOGIN_MIN_LENGTH = 2;
public static final int LOGIN_MAX_LENGTH = 255;
.hasMessage("Login is too short (minimum is 2 characters)");
}
-
@Test
public void fail_to_create_user_login_start_with_underscore() {
assertThatThrownBy(() -> {
.hasMessage("Login should not start with .-_@");
}
+ @Test
+ public void create_user_login_contains_underscore() {
+ createDefaultGroup();
+ String login = "name_with_underscores";
+ NewUser newUser = NewUser.builder()
+ .setLogin(login)
+ .setName("Marius")
+ .setEmail("marius@mail.com")
+ .setPassword("password")
+ .build();
+
+ underTest.createAndCommit(db.getSession(), newUser, u -> {});
+
+ assertThat(dbClient.userDao().selectByLogin(session, login)).isNotNull();
+ }
@Test
public void fail_to_create_user_with_too_long_login() {
import java.io.InputStream;
import java.util.Optional;
import java.util.zip.GZIPInputStream;
-import java.util.zip.InflaterInputStream;
import org.sonar.api.scanner.fs.InputProject;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.Logger;
private ProgressReport progressReport;
public ProjectFileIndexer(InputComponentStore componentStore, ProjectExclusionFilters exclusionFilters,
- SonarGlobalPropertiesFilter sonarGlobalPropertiesFilter, InputModuleHierarchy inputModuleHierarchy, GlobalConfiguration globalConfig, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings,
+ SonarGlobalPropertiesFilter sonarGlobalPropertiesFilter, InputModuleHierarchy inputModuleHierarchy,
+ GlobalConfiguration globalConfig, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings,
FileIndexer fileIndexer, ProjectCoverageAndDuplicationExclusions projectCoverageAndDuplicationExclusions, ScmConfiguration scmConfiguration) {
this.componentStore = componentStore;
this.sonarGlobalPropertiesFilter = sonarGlobalPropertiesFilter;