Prevent 'Save Password' dialog in the browser using Angular 4

921 views
Skip to first unread message

vishnu siddareddy

unread,
Dec 3, 2018, 11:19:17 AM12/3/18
to Angular and AngularJS discussion
How do i prevent the 'save password' dialog box in the browser using Angular 4. I tried to adding hidden password field but not working.

<form [formGroup]="loginFrm" class="form-horizontal" autocomplete="off">

   
<div class="form-group">
       
<div class="col-md-12">
           
<input type="text" class="form-control" name="username" placeholder="Username" formControlName="username" autocomplete="off"/>
       
</div>
   
</div>

   
<div class="form-group">
     
<div class="col-md-12">
         
<input type="password" autocomplete="off" tabindex="-1" style="display:none">
         
<input type="password" class="form-control" placeholder="Password" name="password" formControlName="password" autocomplete="off" required/>
     
</div>
   
</div>
</form>


Sander Elias

unread,
Dec 3, 2018, 11:27:26 AM12/3/18
to Angular and AngularJS discussion
Hi Vishnu,


I'm not 100% sure, but this seems to work in most situations:

<input type="text" name="UserName" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');" >
<input type="password" name="Password" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');" >

This is however totally depending on undocumented browser behavior. Renaming the password field to something different might add some additional protection.

Be aware that this will annoy the hell out of most users, they prefer to save their passwords!

Regards
Sander

Katheeja Beevi

unread,
Dec 3, 2018, 11:41:54 AM12/3/18
to ang...@googlegroups.com
How to give oracle db connectivity for this?

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages