[CLOSED] [#1154] Chrome saving login/password

Page 2 of 3 FirstFirst 123 LastLast
  1. #11
    Thank you, @Z.

    Just to clarify - I would personally prefer a working v1 sample with a DirectEvent request. Before I was never able to get it working without a hard PostBack. It would be a great lesson for me.
  2. #12
    This is a full example for v1.7.

    It has worked on Chrome and my Android (kitkat now) for about 2 years. Also worked on a bunch of other machines and properly saved passwords in v1.7

    Thanks,
    /Z

    
    
    
    
    
    
    
    
    <%@ Page Language="C#" AutoEventWireup="true" %>  
    
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Test</title>    
        <style type="text/css">
            h1 {
                font: normal 60px tahoma, arial, verdana;
                color: #E1E1E1;
            }
            
            h2 {
                font: normal 20px tahoma, arial, verdana;
                color: #E1E1E1;
            }
            
            h2 a {
                text-decoration: none;
                color: #E1E1E1;
            }
    
    
            .align-right {
                float: right;
            }
            .x-window-mc {
                background-color : #F4F4F4 !important;
            }
        </style>
        <script type="text/javascript">
            var funcFocus = function (field) {
                field.focus();
            }
    
    
            if (window.top.frames.length !== 0) {
                window.top.location = self.document.location;
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:Window 
            ID="LoginWindow"
            runat="server" 
            Closable="false"
            Resizable="false"
            AutoHeight="true"
            Icon="Lock" 
            Title="Login"
            Draggable="true"
            Width="300"
            Modal="true"
            Layout="fit"
            BodyBorder="false"
            Padding="5">        
            <Items>
                    <ext:FormPanel 
                        runat="server" 
                        FormID="loginForm"
                        Border="false"
                        Layout="form"
                        BodyBorder="false" 
                        BodyStyle="background:transparent;" 
                        
                        Url='<%# Html.AttributeEncode(Url.Action("Login")) %>'>
                        <Items>
                            <ext:TextField 
                                ID="txtUsername" 
                                runat="server" 
                                FieldLabel="Username" 
                                AllowBlank="false"
                                BlankText="Username is required."
                                Text=""
                                AutoFocus="true"
                                AutoFocusDelay="100"
                                AnchorHorizontal="100%"
                                >
                                </ext:TextField>
                             <ext:TextField 
                                ID="txtPassword" 
                                runat="server" 
                                InputType="Password" 
                                FieldLabel="Password" 
                                AllowBlank="false" 
                                BlankText="Password is required."
                                Text=""
                                AnchorHorizontal="100%"
                                />
                        </Items>
                        <KeyMap>
                            <ext:KeyBinding>             
                                <Keys>
                                    <ext:Key Code="ENTER" />             
                                </Keys>
                                <Listeners>
                                    <Event Handler="Ext.getCmp('LoginButton').fireEvent('click')" />
                                </Listeners>
                            </ext:KeyBinding>     
                         </KeyMap>
                    </ext:FormPanel>
            </Items>
            <Buttons>
                <ext:Button ID="LoginButton" runat="server" Text="Login" Icon="Accept">
                    <DirectEvents>
                        <Click 
                            Url="/Login/" 
                            Timeout="60000"
                            FormID="loginForm"
                            CleanRequest="true" 
                            Method="POST"
                            Before="Ext.Msg.wait('Verifying...', 'Authentication');"
                            Failure="Ext.Msg.show({
                               title:   'Login Error',
                               msg:     result.message || result.errorMessage,
                               buttons: Ext.Msg.OK,
                               icon:    Ext.MessageBox.ERROR
                            });">
                            <EventMask MinDelay="250" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Window>
    </body>
    </html>
  3. #13
    Thank you.

    I ran the test case in Chrome.

    1. Type some Username and Password
    2. Click the Login button
    3. Chrome does NOT offer to save the password

    Please clarify is the existing Login URL required to reproduce the password saving functionality? Could you, please, try to change the Login URL it to some fake URL and check if the password saving functionality still works for you or it doesn't?
  4. #14
    :) i think going back and forth on this isnt the best use of time. hehe

    I have been running that code for years and it worked for me. i have no idea how but take my word it did.

    In any case, can you please post a sample that does work properly that i can post to a Controller? I think that would be simpler. i would recommend to add this to the examples explorer.

    Thanks,
    /Z
  5. #15
    :) i think going back and forth on this isnt the best use of time. hehe
    I agree.

    I have been running that code for years and it worked for me. i have no idea how but take my word it did.
    Certainly, I took your word and there is no doubt. I am not looking for a proof of your word, but I am looking for your help to help you.

    In any case, can you please post a sample that does work properly that i can post to a Controller? I think that would be simpler.
    Sure, it would be simpler, but I just could not get it working. I could get it working only with a hard PostBack. Though, I will try again.

    Please clarify have you tested your code sample outside of the application where it works? Say, in a freshly created MVC project. I assume there is something in your project that makes it working...

    i would recommend to add this to the examples explorer.
    Thank you for the suggestion! Most likely we will.
  6. #16
    I still cannot get it working.

    Posting View > Page Sources and the actual generated HTML after rendering might be helpful.
  7. #17
    Only tested in the app. I have no idea why it worked. I don't have any public examples as we fully completed our migration from v1.7 to v3.2.1

    Just post closest working example and I will review and tweak it as needed.
    /Z
  8. #18
    I've converted this example to Ext.NET MVC.
    https://www.sencha.com/forum/showthr...=1#post1079672

    View
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.Net.MVC v3 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:Window runat="server" Title="Login" Width="300">
            <Items>
                <ext:FormPanel runat="server" BodyPadding="10">
                    <AutoEl Tag="Form">
                        <CustomConfig>
                            <ext:ConfigItem Name="method" Value="POST" Mode="Value" />
                            <ext:ConfigItem Name="action" Value="/Aspx/Login/" Mode="Value" />
                            <ext:ConfigItem Name="target" Value="submitTarget" Mode="Value" />
                        </CustomConfig>
                    </AutoEl>
                    <Items>
                        <ext:TextField
                            runat="server"
                            Name="username"
                            FieldLabel="Username"
                            AllowBlank="false">
                            <CustomConfig>
                                <ext:ConfigItem Name="inputAttrTpl" Value="['autocomplete=&quot;on&quot;']" Mode="Raw" />
                            </CustomConfig>
                        </ext:TextField>
    
                        <ext:TextField
                            runat="server"
                            Name="password"
                            FieldLabel="Password"
                            AllowBlank="false"
                            InputType="Password">
                            <CustomConfig>
                                <ext:ConfigItem Name="inputAttrTpl" Value="['autocomplete=&quot;on&quot;']" Mode="Raw" />
                            </CustomConfig>
                        </ext:TextField>
    
                        <ext:Component runat="server" Html="<iframe id='submitTarget' name='submitTarget' style='display:none'></iframe>" />
    
                        <ext:Component runat="server" Html="<input type='submit' id='submitButton' style='display:none' />" />
                    </Items>
                    <Buttons>
                        <ext:Button
                            runat="server"
                            Text="Login"
                            FormBind="true"
                            Handler="Ext.getElementById('submitButton').click();" />
    
                        <ext:Button
                            runat="server"
                            Text="Reset"
                            Handler="btn.up('form').getForm().reset();" />
                    </Buttons>
                </ext:FormPanel>
            </Items>
        </ext:Window>
    </body>
    </html>
    Controller
    public class AspxController : System.Web.Mvc.Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public ActionResult Login(string username, string password)
        {
            // Just to see in a response that username/password have been submitted
            return this.Json(new
            {
                username = username,
                password = password
            });
        }
    }
  9. #19
    so the good news is that the example definitely prompts me to save my password and that works great.

    however, when i click Login, i am prompted to Open the json. i expected it to redirect me to the location. I guess that is on my side and i will see what is going on. let me review more.

    ok. my controller does this on success:
    return new Ext.Net.MVC.DirectResult("window.location='/ta/Home/Index';");
    since we are no longer MVC, this is not invalid and just prompts me to open it in notepad :)

    Thanks,
    /Z
    Attached Thumbnails Untitled.png  
    Last edited by Z; Nov 13, 2015 at 7:33 PM.
  10. #20
    Yes, that submitting (via <input type='submit' ...) is not a DirectEvent and a DirectResult cannot be used.

    I tried this:
    public ActionResult Login(string username, string password)
    {
        return this.Redirect("other URL");
    }
    But redirection happens in a hidden iframe, because of
    <ext:ConfigItem Name="target" Value="submitTarget" Mode="Value" />
    Personally, I am not sure why it is required and I tried to remove it.

    As well as
    <ext:Component runat="server" Html="<iframe id='submitTarget' name='submitTarget' style='display:none'></iframe>" />
    It looks like it still triggers password saving and redirection works well.

    Please try.
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. [CLOSED] Password fields TextField saves the password
    By ucaneto in forum 2.x Premium Help
    Replies: 1
    Last Post: Oct 29, 2014, 3:38 PM
  2. Replies: 9
    Last Post: Jul 25, 2012, 2:19 PM
  3. Replies: 0
    Last Post: Feb 23, 2012, 6:18 AM
  4. Implement a Password Meter to a Password Field
    By sudantha in forum 1.x Help
    Replies: 1
    Last Post: Jan 15, 2012, 6:59 AM
  5. login problem with Ext Login Control
    By Bruce2010 in forum 1.x Help
    Replies: 1
    Last Post: Nov 30, 2010, 4:35 PM

Tags for this Thread

Posting Permissions