Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate core.Logins and operations away from email address #456

Merged
merged 2 commits into from
Nov 7, 2024
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 @@ -97,6 +97,7 @@
import org.labkey.api.query.ValidationException;
import org.labkey.api.security.AdminConsoleAction;
import org.labkey.api.security.Group;
import org.labkey.api.security.LoginManager;
import org.labkey.api.security.MutableSecurityPolicy;
import org.labkey.api.security.PrincipalType;
import org.labkey.api.security.RequiresAnyOf;
Expand Down Expand Up @@ -889,7 +890,7 @@ public boolean handlePost(PublicDataUseForm form, BindException errors)
errors.reject(ERROR_MSG, "User with given email address does not exist");
return false;
}
if (!SecurityManager.matchPassword(form.getUserPassword(), SecurityManager.getPasswordHash(validEmail)))
if (!LoginManager.matchPassword(form.getUserPassword(), LoginManager.getPasswordHash(user)))
{
errors.reject(ERROR_MSG, "Incorrect password for " + user.getEmail());
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.labkey.api.query.ValidationException;
import org.labkey.api.security.Group;
import org.labkey.api.security.InvalidGroupMembershipException;
import org.labkey.api.security.LoginManager;
import org.labkey.api.security.MemberType;
import org.labkey.api.security.MutableSecurityPolicy;
import org.labkey.api.security.PasswordRule;
Expand Down Expand Up @@ -649,7 +650,7 @@ private ReviewerAndPassword createReviewerAccount(String reviewerEmailPrefix, Us

log.info("Generating password.");
String password = createPassword(newUser.getUser());
SecurityManager.setPassword(email, password);
LoginManager.setPassword(newUser.getUser(), password);
log.info("Set reviewer password successfully.");

return new ReviewerAndPassword(newUser.getUser(), password);
Expand Down
5 changes: 3 additions & 2 deletions signup/src/org/labkey/signup/SignUpController.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.labkey.api.security.AuthenticationManager.AuthenticationResult;
import org.labkey.api.security.DbLoginService;
import org.labkey.api.security.Group;
import org.labkey.api.security.LoginManager;
import org.labkey.api.security.RequiresLogin;
import org.labkey.api.security.RequiresNoPermission;
import org.labkey.api.security.RequiresPermission;
Expand Down Expand Up @@ -422,7 +423,7 @@ public boolean handlePost(SignupConfirmForm form, BindException errors) throws E
newUser.setDescription(StringUtils.isBlank(_tempUser.getOrganization()) ? "" : "Organization: " + _tempUser.getOrganization()); // don't add anything if organization is empty

// Attempt to set this new user's password and log them in
AuthenticationResult result = DbLoginService.get().attemptSetPassword(getContainer(), getUser(), form.getPassword(), form.getPassword2(), getViewContext().getRequest(), _email, PageFlowUtil.urlProvider(ProjectUrls.class).getHomeURL(), "Verified and chose a password.", true, errors);
AuthenticationResult result = DbLoginService.get().attemptSetPassword(getContainer(), getUser(), form.getPassword(), form.getPassword2(), getViewContext().getRequest(), newUser, PageFlowUtil.urlProvider(ProjectUrls.class).getHomeURL(), "Verified and chose a password.", true, false, errors);

if (errors.hasErrors())
return false;
Expand Down Expand Up @@ -839,7 +840,7 @@ private TempUser getTempUser(SignupForm signupForm, ValidEmail email) throws jav
tempUser.setFirstName(signupForm.getFirstName());
tempUser.setLastName(signupForm.getLastName());
tempUser.setOrganization(signupForm.getOrganization());
tempUser.setKey(SecurityManager.createTempPassword());
tempUser.setKey(LoginManager.createTempPassword());
tempUser.setContainer(getContainer());

Table.insert(null, SignUpManager.getTableInfoTempUsers(), tempUser);
Expand Down