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>