Experiencing a challenge with the Change Password feature in Angular JS/Django REST module. Encountering issues

Seeking assistance with implementing a change password feature for a user in AngularJS and Django REST framework as the backend API.

The form includes two password input fields - one for the current password and another for the new password - along with a submit button.

Upon submitting, a browser window prompts me to "Change password for which user" displaying a list of saved users and their passwords only when the input field type is set to "password" rather than "text."

If anyone can provide guidance on this issue, it would be greatly appreciated.

Below are snippets of my HTML View:

<form name="change_pass" ng-submit="changePass(user)">
    <md-input-container class="md-accent md-hue-2">
        <md-icon class="material-icon">lock</md-icon>
        <input ng-model="user.currentPass" type="password" placeholder="Current Password">
    </md-input-container>

    <md-input-container class="md-accent md-hue-2">
        <md-icon class="material-icon">lock</md-icon>
        <input ng-model="user.newPass" type="password" placeholder="New Password">
    </md-input-container>

    <md-button type="submit" class="md-raised md-primary">Submit</md-button>
</form>

This is my JS(Controller):

$scope.changePass = function(user){
    AuthService.changePassword(user);
}

This is my AuthService:

Authorization.changePassword = function(user){
    var id = $cookies.get('user');
    var postData = {
        "newpassword": user.newPass,
        "username": id,
        "currentpassword": user.currentPass
    }
    $activityIndicator.startAnimating();
    $http({
        method: 'PUT',
        url: CHANGE_PASSWORD+id+'/',
        data: postData,
        headers: {'Authorization': 'Token ' + $cookies.get('token')}
    })
    .success(function(data, status, header, config){
        $activityIndicator.stopAnimating();
        toastr.success("Password Sucessfully changed!", " Security");
    })
    .error(function(data, status, header, config){
        $activityIndicator.stopAnimating();
        toastr.error("Your Password could not be changed", " Security");
    });
}

Any help or suggestions would be highly valued. Thank you!

Answer №1

Most web browsers are equipped with automatic detection for "standard login/password" forms. When these forms are submitted, a dialog box is displayed.

Neither Angular nor Django has the capability to address this issue directly. For solutions, please refer to: Disable browser 'Save Password' functionality

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 styling of Material UI (MUI) buttons is not displaying correctly

Why are my MUI button components displaying differently than the documentation? I have not made any external .css file or theme changes except for the ones listed. I have also installed the Roboto font and configured the typography. I want any changes I ma ...

Utilize IntelliJ's TypeScript/JavaScript feature to extract a method from all instances

I am relatively new to using IntelliJ Idea Ultimate 2020 and I am currently exploring the refactoring functionalities within the software. Is there a way to extract a method from a section of code and apply it to all instances easily and exclusively withi ...

How come my browser is mistaking my index.html file for a JavaScript file with this "Uncaught Syntax Error ... <" message?

Looking for some experienced eyes to help me figure out what's happening. I received this unexpected message. When I clicked on mainCtrl.js:1, devTools displayed something odd. How did my browser suddenly think that my index.html is now mainCtrl.js ...

I am interested in using Python PIL to create an image that is centered with text from a URL and then download it. Can anyone provide guidance on how

Is there a way to input text in a URL and download an image with the text centered on it? For example, when I insert , I want to download an image where the text 'hello' is centered. def generate_image(request, name): text = name img = ...

Tips for preventing redundant HTTPInterceptor requests when transitioning between RxJS mergeMap operations

My system utilizes two JWT tokens: a Refresh Token (expires after 7 days) and an Access Token (expires after 15 minutes). These tokens are securely stored on httpOnly cookies and can be accessed via the server. The refresh method generates a new token and ...

There is an error occurring in Angular 9 when trying to implement a search filter for an object array with heterogeneous types

Trying to search through an array of objects using key-value pairs, but encountering an error in the console: core.js:5873 ERROR TypeError: obj[key].includes is not a function a = [ { id: 0, name: "xyz", grade: "x", frade: [ { name: "Paul", ...

Unable to save vcard on iPhone using Chrome browser

I am encountering difficulties when trying to download a vCard on iPhone Chrome. I am making an API call from the href link which is supposed to return a .vcf file for downloading the vCard. This functionality works seamlessly on desktop browsers such as I ...

Proceed with the execution of the script after a successful completion of the jQuery AJAX request

I am facing a challenge with my click function that needs to open a popup window once the ajax call is successful. I have tried different solutions like setting async: false, placing the popup in the ajax call (which got blocked by the browser), and using ...

Navigate to the end of the chat window using AngularJS

Is there a way to automatically scroll to the bottom whenever a new message is received? I have code that moves the scrollbar, but it doesn't go all the way to the bottom. Can someone please help me with this? Here is my code on Plunker: http://plnk ...

$scope disappears following asynchronous call

In a previous project, I had this code working flawlessly. However, when I transferred the code to a new project, even the simplest case is failing. This is what my controller looks like: angular.module('myApp.controllers'). controller(' ...

Having trouble with the page layout in AngularJS

I am currently delving into Angular JS in order to fulfill some academic requirements. The issue I am facing is with the rendering of a landing page after successfully logging in through a login portal that caters to three types of users. Strange enough, w ...

Please ensure that the Slit Slider stops on the final slide

Hey everyone, I've been using the Slit slider from http://tympanus.net/codrops/2012/10/24/slit-slider-revised, but I'm struggling to make it stop on the last slide. Although I'm new to JQuery, I've tried various methods found online, bu ...

Proceed the flow of event propagation using the react-aria button element

In the react-aria library, event bubbling for buttons is disabled. I am facing an issue where my button, which is nested inside a div that acts as a file uploader, does not trigger the file explorer when clicked due to event bubbling being disabled. How ...

The compiler throwing an error claiming that the indexOf method is not a valid

Currently, I am working on a simple form that collects user input and aims to validate the email field by checking for the presence of "@" and "." symbols. However, every time I attempt to run it, an error message stating that indexOf is not a function p ...

Uncover the mystery that lies within the unknown depths

Having the JSON data below: var lists = [{ "listId": 1, "permission": "WRITE" }, { "listId": 2, "permission": "WRITE" }, { "listId": 2, "permission": "READ" }, { "listId": 3, "per ...

Struggling with updating an object in Express and Mongoose

Is there a way to update an object by adding a new field defined in the schema? Here's what I have: const updatePlotObject = async (request, response) => { let modifications = {}; modifications = Object.assign(modifications, request.body.p ...

Using Radio button to access local HTML pages - A step-by-step guide

I am currently working on a project that involves the use of radio buttons and their corresponding options. My goal is to have each radio button selection lead to a specific HTML page being displayed. I've come across solutions involving external URLs ...

Issue with loop detected in <fieldset> tags - prematurely adding closing tag

In the development of my web app using Google Apps Script, I am faced with the challenge of creating a set of checkbox fields for each learner/student, displayed in rows of three. These checkboxes are generated from data stored in a spreadsheet. My goal i ...

The switch statement within Angular returns null when using getElementById()

In my single page application, I am using ng-switch to switch between different 'pages'. One of these pages contains a modal that is opened using the following function: var modal = document.getElementById('myModal'); vm.openModal = fu ...

ResponseXML in AJAXBindingUtil

I'm having an issue with the responseXML in my AJAX code. Here is an excerpt from my callback function: var lineString = responseXML.getElementsByTagName('linestring')[0].firstChild.nodeValue; The problem I'm facing is that the linest ...