mercredi 31 mai 2017

TypeError: Failed to construct 'PasswordCredential': 'id' must not be empty

I want to implement credential management API in my angular app

my login.html looks like this

<div id="login-form" data-ng-form="loginForm" data-ng-controller="LoginFormController">
    <div>
        <input type="text" name="username" placeholder="username" data-ng-model="loginCredentials.username" id="uid" autocomplete="username">
        <input type="password" name="password" placeholder="password" data-ng-model="loginCredentials.password" id="pwd" autocomplete="new-password">
    </div>
    <div>
        <button id="loginButton" data-ng-click="login()">label.button.login</button>
    </div>
    <div data-ng-show="authenticationFailed">
        <p></p>
    </div>
</div>

I have LoginFormController as my Controller. Inside the function i created new object called PasswordCredential like this

            var form = angular.element('#login-form');
            //console.log(form);
            var cred  = new PasswordCredential(form);
            //store the credentials
            navigator.credentials.store(cred)
            .then(function(){

            });
            

But i am getting the error PasswordCredential : id must not be empty

Help please




Aucun commentaire:

Enregistrer un commentaire