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

1051: No feedback pw reset #1052

Merged
merged 2 commits into from
Jul 11, 2023
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 @@ -42,8 +42,8 @@ const ForgotPasswordController = () => {
{finished ? (
<>
<p>
Wir haben eine E-Mail an {email} gesendet. Darin finden Sie einen Link, mit dem Sie Ihr Passwort
zurücksetzen können.
Falls die angegebene E-Mail-Adresse {email} in unserem System existiert, wird eine E-Mail an sie gesendet.
Darin finden Sie einen Link, mit dem Sie Ihr Passwort zurücksetzen können.
</p>
<p>Bitte prüfen Sie Ihren Spam-Ordner.</p>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ class ResetPasswordMutationService {
val projectConfig = backendConfig.projects.first { it.id == project }
transaction {
val user = Administrators.innerJoin(Projects).slice(Administrators.columns)
.select((Projects.project eq project) and (LowerCase(Administrators.email) eq email.lowercase()))
.single().let { AdministratorEntity.wrapRow(it) }

val key = AdministratorsRepository.setNewPasswordResetKey(user)
Mailer.sendResetPasswodMail(backendConfig, projectConfig, key, email)
.select((Projects.project eq project) and (LowerCase(Administrators.email) eq email.lowercase())and (Administrators.deleted eq false))
.singleOrNull()?.let { AdministratorEntity.wrapRow(it) }
michael-markl marked this conversation as resolved.
Show resolved Hide resolved
// We don't send error messages for empty collection to the user to avoid scraping of mail addresses
if (user != null) {
val key = AdministratorsRepository.setNewPasswordResetKey(user)
Mailer.sendResetPasswodMail(backendConfig, projectConfig, key, email)
}
}
return true
}
Expand All @@ -38,7 +40,7 @@ class ResetPasswordMutationService {
fun resetPassword(project: String, email: String, passwordResetKey: String, newPassword: String): Boolean {
transaction {
val user = Administrators.innerJoin(Projects).slice(Administrators.columns)
.select((Projects.project eq project) and (LowerCase(Administrators.email) eq email.lowercase()))
.select((Projects.project eq project) and (LowerCase(Administrators.email) eq email.lowercase()) and (Administrators.deleted eq false))
.single().let { AdministratorEntity.wrapRow(it) }

if (user.passwordResetKeyExpiry!!.isBefore(Instant.now())) {
Expand Down