Skip to content

Enhance User Authentication in TWS-ACP.php: Restrict Login to Specific Credentials #3

@BOSS294

Description

@BOSS294

Description:

Update the authenticateUser function in the file TWS-ACP.php to add a condition that allows login only when the email is demo@gmail.com and the password is demo1234. If the credentials do not match, show an error toast with the message:

showToast(simulatedResponse.message || 'Invalid credentials. Please try again.', 'error');

Updated Function:

function authenticateUser(email, password) {
    const simulatedResponse = {
        success: email === 'demo@gmail.com' && password === 'demo1234',  
        message: email === 'demo@gmail.com' && password === 'demo1234'
            ? 'Login successful!'
            : 'Invalid credentials. Please try again.'
    };

    if (simulatedResponse.success) {
        showToast(simulatedResponse.message, 'success');
        window.location.href = 'dashboard.php';
    } else {
        showToast(simulatedResponse.message, 'error');
    }
}

This ensures that only the specified credentials (demo@gmail.com and demo1234) can successfully authenticate. All other attempts will result in an error toast message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions