如何实现"记住"本地和远程登录页面的功能? [英] How to achieve "Remember Me" functionality for both local and remote login pages?

查看:161
本文介绍了如何实现"记住"本地和远程登录页面的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS和Android应用程序的要求,使用IBM工作灯,如果用户选择此选项可以记住用户ID的发展。

I have a requirement in my application for iOS and Android, developed using IBM Worklight, to remember the user ID if the user selected this option.

我可以通过使用本地存储实现这一点,但问题是,我的两个的登录页面:

I can achieve this by using localStorage, but the issue is that I have two login pages:


  • 一个被放置在应用程序中,而

  • 二是托管在远程服务器上

根据不同的应用程序将符合条件的,无论是远程登录页面将显示或本地登录页会显示出来。

Depending on the conditions the application will meet, either the remote login page will be displayed or the local login page will be displayed.

如果我使用localStorage的本地网页上它不是为服务器端登录页面访问。所以我想用一些存储/文件的移动存储我的用户ID它是本地和服务器登录页面访问。这是有可能使用工作灯/ PhoneGap的存储?

If I use localStorage on local page it is not accessible for server side login page. So I want to use some storage/file on the mobile to store my user id which is accessible for both local and server login page. Is this is possible using worklight/phonegap storage?

更多的解释:

远程登录页面托管在一些www.xxx.com域。我的要求是在启动应用程序的本地登录页面显示给用户,但用户可以输入用户名和密码,并选择记得我的选择并提交表单。然后,用户登录和浏览到一些xxx.com/yyy服务器页面。从那里,当用户点击注销其定位到这是www.xxx.com服务器上承载远程登录页面。由于已经检查用户记得我在当地页选项远程登录页面有pre填充用户ID文本框。而当用户在远程登录页面凭据,并选择记得我复选框应该发生同样的情况。因此,当用户从后台杀死应用和重新推出,我需要pre填充用户ID,他进入最后一次应用程序的用户将获得本地登录页面。

Remote login page is hosted on some www.xxx.com domain. My requirement is on launch of application the local login page is shown to the user, there user can enter user id and password and selects remember me option and submits form. Then user logs in and navigated to some xxx.com/yyy server page. From there when user clicks on log out it navigates to remote login page which is hosted on www.xxx.com server. As user already checked remember me option in local page the remote login page has to pre populate the user id text box. And same scenario should happen when user enters credentials in remote login page and selects remember me check box. So when user kills the application from background and relaunches the application user will get local login page where I need to pre populate the user id last time he entered.

推荐答案

简短的回答:在我看来,没有

Short answer: in my opinion, no.

更长的答案:我会解释什么,我认为使用您的方案:

Longer answer: I will explain what I think using your scenario:

远程登录页面托管在一些www.xxx.com域。我的要求
  是在启动应用程序的本地登录页面显示给用户,
  有用户可以输入用户名和密码,并选择记得我
  选项​​并提交表单。

Remote login page is hosted on some www.xxx.com domain. My requirement is on launch of application the local login page is shown to the user, there user can enter user id and password and selects remember me option and submits form.

到目前为止好。你可以将其存储在任何Web存储或JSONStore或使用科尔多瓦文件API。发现:所有这些只适用于特定的应用。

So far so good. You can store it in either Web Storage or JSONStore or use Cordova File API. Catch: all of these are available ONLY for the specific application.

然后用户登录并浏览到一些xxx.com/yyy服务器页面。从
  当有用户点击注销其定位到远程登录页面
  其中托管www.xxx.com服务器上。由于用户已经检查
  记得我在当地页选项远程登录页面有pre
  填充用户ID文本框。

Then user logs in and navigated to some xxx.com/yyy server page. From there when user clicks on log out it navigates to remote login page which is hosted on www.xxx.com server. As user already checked remember me option in local page the remote login page has to pre populate the user id text box.

还是有道理的。比方说,用户选择记住我,这样你就可以调整URL指向远程登录页面和发送作为参数用户名密码。假设有将一种机制来处理这些远程页面上。

Still plausible. Lets say the user selected 'Remember Me', so you can adjust the URL pointing to the remote login page and send with it as parameters the username and password. Assuming that there will a mechanism to handle those on the remote page.

这不来免费的,虽然。

  • This is not meant to work out-of-the-box. It's worth noting that whether Web Storage (localStorage...) is used or any other type of storage- the application and the Cordova InAppBrowser do not share the same localStorage, and the same is true if you open a new WebView.

而当用户在远程凭据应该发生相同的情况下
  登录页面,选择记得我复选框。因此,当用户关闭
  从背景和应用程序将重新启动应用程序的用户将
  获取本地登录页面,我需要pre填充最后的用户ID
  时间他进入。

And same scenario should happen when user enters credentials in remote login page and selects remember me check box. So when user kills the application from background and relaunches the application user will get local login page where I need to pre populate the user id last time he entered.

这也是IMO一个问题,因为任何应用程序是沙箱 - 无论是浏览器的应用程序或应用程序工作灯,他们每个人是沙箱。所以你不能只是去网站X,并创建一些localStorage的它,并期望这些数据可用于属于另一个应用程序的WebView另一个。这是沙箱的整点,以保护应用程序。

This is also a problem IMO, because any application is sandboxed - be it the browser app or the Worklight app, each of them is sandboxed. so you can't just go to website X, and create some localStorage for it and expect that data to be available for another WebView belonging to another app. That's the whole point of sandboxing, in order to protect the app.

在这种情况下,这里的远程页将保存的数据,仅Web存储可用反正JSONStore需要工作灯API,当你加载外部网站是不可用的。

And in this case, where the remote "page" will save the data, only Web Storage is available anyway, as JSONStore requires the Worklight API, which is not available when you load external websites.

注:


  • 由于要节省用户名密码,你可能想要将它们以某种方式加密,<一个href=\"http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.dev.doc/devref/c_jsonstore_overview.html\"相对=nofollow>所以JSONStore和WL.EncryptedCache是​​你的选择,而不是简单的网络存储。

  • Since you want to save both username and password, you'd probably want to encrypt them in some way, so JSONStore and WL.EncryptedCache are your options, rather than plain Web Storage.

这篇关于如何实现&QUOT;记住&QUOT;本地和远程登录页面的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆