It is not entirely clear how to process (implement the service correctly) username and password data. Data username and password are in the database. Tell me ideas in which direction to move.
login.html
<div class="container"> <p><br/></p> <div class="row"> <div class="col-md-4 col-md-offset-4"> <div class="panel panel-default"> <div class="panel-body" style="background-color: transparent"> <div class="page-header"> <h1>Log in</h1> </div> <!-- Start Form--> <form method="post" name="loginForm"> <!-- Start gorm-group username--> <div class="form-group"> <label for="exampleInputEmail1">Username or email</label> <div class="input-group"> <span class="input-group-addon" id="icon1"><span class="glyphicon glyphicon-user"></span></span> <input type="text" class="form-control" name="userLogin" id="exampleInputEmail1" ng-model="username"> </div> <label id="userLoginLabel" for="exampleInputEmail1"></label> </div> <!-- Start gorm-group password--> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <div class="input-group"> <span class="input-group-addon" id="icon2"><span class="glyphicon glyphicon-lock"></span></span> <input type="password" class="form-control" name="userPassword" id="exampleInputPassword1" ng-model="password"> </div> <label id="passwordLabel" for="exampleInputPassword1" style="color:red"></label> </div> <div class="checkbox"> <label> <input type="checkbox" name="rememberMe">Remember me </label> </div> <hr/> <button type="submit" value="Submit" name="loginSubmit" class="btn btn-success" ng-click="login()">Log in</button> <a href="#"> <button type="button" name="signUpSubmit" class="btn btn-primary">Register </button> </a> <a href="#">Forgot your password?</a> </form> <script type="text/javascript"> </script> <!-- End Form--> </div> </div> </div> </div> </div> LoginController.js
'use strict'; angular.module('Login').controller('LoginController', function ($scope, $state, $cookies, AuthenticationService) { $scope.login = function() { AuthenticationService.signIn($scope.username, $scope.password, function onSuccess(payload) { $state.go("dashboard"); }, function onError() { $state.go("login"); } ); } }); AuthenticationService.js
'use strict'; app.factory('AuthenticationService', function (Network, $cookies) { return { signIn: function (username, password, onSuccess, onError) { Network.sendPost("/services/authentication/signIn", {"login": username, "password": password}, onSuccess, onError); }, signOut: function(onSuccess) { Network.sendGet("/services/authentication/signOut", {}, onSuccess); } }; });