Verifying the user's email and password for authentication

Is there a way to verify the authenticity of the email and password entered in the form, so that I can redirect to a new page? Unfortunately, upon reloading the page, the validation process seems to fail in checking whether the user email and password are correct, resulting in no action being taken. The only feedback received is a request to verify the user email and password.

var app = angular
    .module('formValidation', ['ui-router'])
    .controller("locationFormCtrl", locationFormCtrl); 
    // .config('$stateprovider','$urlRouterProvider',routeFunc);

    function locationFormCtrl($http,config){
      $http.post(config.apiUrl+ "login", {email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8beee3e5e0cbece6eae2e7a5e5e7">[email protected]</a>", password: "welkom123"}).then(function(response){
          if(email == "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f6e7a6b7d6a764f6e7f7f7c676e7d666168216163">[email protected]</a>" & password == "welkom123"){
            header('Location : opdrachten.html');
          }else{
            alert('wrong password');
          }
      });
    }
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body ng-app="formValidation" ng-controller="locationFormCtrl" >
<form novalidate class="simple-form" ng-submit="submit()">
<label>Email: <input type="text" ng-model="user.email" name="email"/></label><br>
<label>Password: <input type="password" ng-model="user.password" name="password" required/></label><br>
<input type="submit"  value="login">
</form>
</body>
</html>

Answer №1

//please update condition as below..

if(email == "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="afcedacbddcad6efcedfdfdcc7ceddc6c1c881c1c3">[email protected]</a>" && password == "welkom123"){
   header('Location : opdrachten.html');
}else{
   alert('incorrect password');
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The module specifier "logrocket" could not be resolved, make sure to use either npm or

I'm currently having an issue with initializing LogRocket. I followed the steps from the official documentation: I successfully installed it using node: npm i --save logrocket However, when trying to initialize it on my page earlier with: < ...

What does Event.target.id return - the HTML id value or the HTML name value?

HTML Form Example: <form id="form-product-add" style="display: inline;"> <input name="csrf" type="hidden" value="<?= $this->csrf; ?>"> <input type="hidden" name="a ...

Overriding a shared module service in Angular from a separate module: A step-by-step guide

I am working with various modules such as SchoolModule, UniversityModule, and SharedModule The SharedModule includes a BaseService that both the SchoolModule and UniversityModule providers are utilizing as an extension When loading the SchoolModule, I ne ...

Variable in Javascript file causing return value to be 'undefined'

I have encountered an issue with my JavaScript file. It is extracting data from a SharePoint list and displaying it on an HTML page, but one of the fields appears as 'undefined' even though I defined it initially. The problematic variable is &ap ...

Using a React component to import a module for publishing on NPM

Creating my first React component for NPM publication has been quite the learning experience. I decided to use the react-webpack-component package from Yeoman to kickstart my project. However, upon installing and importing my component into a React app, I ...

Showcasing Portfolio Work in a User-Friendly Mobile Design

Currently revamping my portfolio website and looking for ways to optimize the display of my personal projects. I have a card-like interface in place that works well on desktop but only shows one project at a time on mobile devices. Seeking solutions to imp ...

Is there a way to update the Angular component tag after it has been rendered?

Imagine we have a component in Angular with the selector "grid". @Component({ selector: 'grid', template: '<div>This is a grid.</div>', styleUrls: ['./grid.component.scss'] }) Now, when we include this gri ...

When using useEffect in React, the handleKeyDown function is causing the output to double with each

Whenever a user inputs something, the output doubles each time, leading to a long loop after just a few inputs. Below is the code snippet: const [direction,setDirection] = useState(Array(1).fill(0)); const directions = ["botNorth","botEa ...

What is causing my radio button event to activate when a separate radio button is selected?

I have implemented the code below to display "pers" and hide "bus," and vice versa. JQuery: $('input[name="perorbus"]').click(function() { if ($(this).attr('id') == 'bus') { $('#showbus&apo ...

Integrating JSON back into the system

As I work with Axios to retrieve information from an API, I am able to successfully connect and receive an object with the necessary data. However, I am struggling to display this JSON data in my HTML code. Here is the code snippet I am using: <body&g ...

Issue with Three.js Shader rendering improperly on a specific custom geometry mesh surface

I am facing a challenge with applying a shader to a single face Mesh in Three.js. Upon applying the shader material to the mesh, it seems to only read a single pixel of the shader and apply that value to the entire face. I have tested this using the follo ...

The content within an iframe is inaccessible through JavaScript when the onload event occurs

My current project involves integrating a payment service provider with 3Ds, and one of the steps in the process requires following specific instructions: Upon receiving the response to your initial API request, extract an URL along with some data. Embed ...

What is the best way to iterate through an array and make use of index values while removing any empty elements along the

In my current setup, I have defined two arrays keyVals and rows: keyVals = [ "Status", "ErrorHeading", "ErrorDetail" ] rows = [ { "Hostname": "ABC", "name& ...

I require assistance in displaying a dynamic, multi-level nested object in HTML using AngularJS

I have a complex dynamic object and I need to extract all keys in a nested ul li format using AngularJS. The object looks like this: [{"key":"campaign_1","values":[{"key":"Furniture","values":[{"key":"Gene Hale","values":[{}],"rowLevel":2},{"key":"Ruben A ...

Is it possible to maintain the data types of each individual piece of data when it's divided into an array in

Can the data type of each field be preserved in Javascript after splitting it using the split method? Input: var row = "128, 'FirstName, LastName', null, true, false, null, 'CityName'"; When using the split method, the data type of e ...

After updating Angular Material, the alert dialogs are now transforming into a large dark region

Recently, I encountered an issue while attempting to upgrade my old version of angular-material (v0.9.0) to a newer one. The reason behind this upgrade was the necessity to utilize the new htmlContent for an alert using $mdDialog. However, after replacing ...

Tips on bringing data from a php file into a javascript variable

I'm faced with a challenge where I need to extract data from a MySQL database using a PHP file and then store that data in a JavaScript array for plotting purposes with jQuery's flot library. Has anyone encountered a similar situation and found a ...

Clicking a button opens a new window, except when using the .onclick() method

My current situation involves using software that generates all the HTML/XML code for me, so I don't have direct access to it. I've created a button that is intended to open a form in a new window. Strangely, when I physically click on the button ...

JS call for Bootstrap 5 collapse toggle not functioning as expected

I'm exploring the use of JavaScript to display or hide a collapsible element without toggling between the two states. In other words, I want to prevent the toggle functionality. According to the information provided in the documentation at https://ge ...

What is the correct way to iterate through an object, evaluate three properties, and then push them into an array?

I am tasked with creating a function called runOnRange that will populate a new array based on the properties of an object. The object contains three properties: start, end, and step. The goal is to push specific numbers into the array according to these p ...