Skip to content

Commit

Permalink
Drop requirement for an email address to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Oct 28, 2024
1 parent 192bb0f commit d600e97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/user/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import db from '../database.js';
import log from '../log/service.js';
import { EventType } from '../log/types.js';
import * as loginActivityService from '../login/login-activity/service.js';
import { requireSetting } from '../server-settings.js';
import { getSetting } from '../server-settings.js';
import { User } from '../types.js';

export async function createPassword(user: User, password: string): Promise<void> {
Expand Down Expand Up @@ -82,7 +82,10 @@ type AuthenticationResult = {
* Validate the user password and handle login attempts.
*/
export async function validateUserCredentials(user: User, password: string, ctx: Context): Promise<AuthenticationResult> {
const TOO_MANY_FAILED_ATTEMPTS = `Too many failed login attempts, please contact ${requireSetting('smtp.emailFrom')} to unlock your account.`;

const admin = getSetting('smtp.emailFrom') || 'an administrator';

const TOO_MANY_FAILED_ATTEMPTS = `Too many failed login attempts, please contact ${admin} to unlock your account.`;

if (await loginActivityService.isAccountLocked(user)) {
await loginActivityService.incrementFailedLoginAttempts(user);
Expand Down

0 comments on commit d600e97

Please sign in to comment.