diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
| commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
| tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/zh-cn/web/api/identitymanager | |
| parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
| download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip | |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/zh-cn/web/api/identitymanager')
| -rw-r--r-- | files/zh-cn/web/api/identitymanager/index.html | 43 | ||||
| -rw-r--r-- | files/zh-cn/web/api/identitymanager/watch/index.html | 59 |
2 files changed, 0 insertions, 102 deletions
diff --git a/files/zh-cn/web/api/identitymanager/index.html b/files/zh-cn/web/api/identitymanager/index.html deleted file mode 100644 index 35dab1a6c2..0000000000 --- a/files/zh-cn/web/api/identitymanager/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: IdentityManager -slug: Web/API/IdentityManager -translation_of: Archive/IdentityManager ---- -<p>{{APIRef("Persona")}}{{non-standard_header}}</p> - -<p>The <strong><code>IdentityManager</code></strong> of the <a href="/en-US/docs/Persona" title="BrowserID">BrowserID protocol</a> exposes the BrowserID API, via {{domxref("navigator.id")}}. This API has gone through several significant revisions. Each generation is listed separately below.</p> - -<h2 id="ObserverMethods" name="ObserverMethods">The "Observer" API (Current)</h2> - -<p>The Observer API introduces much-requested features, such as an improved post-verification experience for first-time users, automatic persistent logins, and easier integration with native applications.</p> - -<dl> - <dt>{{ domxref("IdentityManager.watch()")}}</dt> - <dd>Registers callbacks to be invoked when a user logs into or out of a website.</dd> - <dt>{{ domxref("IdentityManager.request()")}}</dt> - <dd>Requests a signed identity assertion from the user.</dd> - <dt>{{ domxref("IdentityManager.logout()")}}</dt> - <dd>Logs the user out of a website and prevents the <code>onlogin</code> action from automatically firing on their next visit.</dd> -</dl> - -<div class="note"> -<p>Users with third-party cookies disabled may experience problems logging in using the Observer API as detailed in <a href="https://github.com/mozilla/browserid/issues/2999" title="https://github.com/mozilla/browserid/issues/2999">issue 2999</a>.</p> -</div> - -<h2 id="CallbackMethods" name="CallbackMethods">The "Callback" API (Current)</h2> - -<p>The Callback API was introduced in November 2011. It improved upon the initial API by allowing options to be passed to <code>navigator.id.get()</code> and offering experimental support for BrowserID-managed persistent sessions.</p> - -<dl> - <dt>{{ domxref("IdentityManager.get()")}}</dt> - <dd>Gets the user's BrowserID in a signed assertion.</dd> -</dl> - -<h2 id="VerifiedEmailMethods" name="VerifiedEmailMethods">The "VerifiedEmail" API (Deprecated)</h2> - -<p>The VerifiedEmail API was BrowserID's first API. It was deprecated at the end of 2011.</p> - -<dl> - <dt>{{ domxref("IdentityManager.getVerifiedEmail()")}} {{ deprecated_inline() }}</dt> - <dd>Gets the user's BrowserID in a signed assertion. This method is deprecated; {{ domxref("navigator.id.get()")}} is backwards compatible and can be used instead.</dd> -</dl> diff --git a/files/zh-cn/web/api/identitymanager/watch/index.html b/files/zh-cn/web/api/identitymanager/watch/index.html deleted file mode 100644 index 1660ccdacf..0000000000 --- a/files/zh-cn/web/api/identitymanager/watch/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: IdentityManager.watch() -slug: Web/API/IdentityManager/watch -translation_of: Archive/IdentityManager/watch ---- -<p>{{ ApiRef("Persona") }}</p> - -<div class="note"><strong>注意:</strong> 不是所有的浏览器都支持这项功能. 使用 Persona 的网站必须在他们的页面中包含 <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">polyfill library</a> .</div> - -<h3 id="Summary" name="Summary">概要</h3> - -<p>This function registers callbacks that respond to a <a href="/en-US/docs/BrowserID" title="BrowserID">Persona</a> user logging in or out.</p> - -<h3 id="Syntax" name="Syntax">语法</h3> - -<pre class="brush:js;">navigator.id.watch({ - loggedInUser: 'bob@example.org', - onlogin: function(assertion) { - // A user has logged in! Here you need to: - // 1. Send the assertion to your backend for verification and to create a session. - // 2. Update your UI. - }, - onlogout: function() { - // A user has logged out! Here you need to: - // Tear down the user's session by redirecting the user or making a call to your backend. - } -}); -</pre> - -<h4 id="参数">参数</h4> - -<dl> - <dt><code>loggedInUser </code>{{ optional_inline() }}</dt> - <dd><strong>NOTE: </strong>This parameter was renamed from <code>loggedInEmail</code> in early September. Both names will continue to work for the time being, but code <strong>should</strong> be changed to use <code>loggedInUser</code> instead.</dd> - <dd>The email address of the currently logged in user. This should be a string containing the user's email address if the website believes that a user is currently logged in, or <code>null</code> otherwise. If the website is unsure, this should be set to <code>undefined</code> or omitted.</dd> - <dd>Persona compares its knowledge of the local user to the value of <code>loggedInUser</code> to determine which callback—<code>onlogin</code>, <code>onlogout</code>, or none at all—to automatically invoke when your page loads. If <code>loggedInUser</code> is <code>undefined</code> or omitted, Persona <em>will</em> invoke either <code>onlogin</code> or <code>onlogout</code>, depending on whether or not a local user should be logged in to your site. These callbacks are not invoked automatically if both BrowserID and <code>loggedInUser</code> agree on the local user's state.</dd> - <dd>Note that Persona may automatically call <em>either</em> <code>onlogin</code> or <code>onlogout</code> when your page loads, but not <em>both</em>. If <code>loggedInUser</code> is set to <code><span class="link-mailto">foo@example.com</span></code>, but Persona believes <code><span class="link-mailto">bar@example.com</span></code> should be logged in, only <code>onlogin</code> will be called. It will have an assertion for <code><span class="link-mailto">bar@example.com</span></code> as its first parameter.</dd> - <dt><code>onlogin</code></dt> - <dd>A function which will be invoked and passed a single argument, an assertion, when the user logs in. This function should send the assertion to the site's backend for verification. If verification succeeds, the backend should establish a session for the user and the function should update the UI as appropriate.</dd> - <dt><code>onlogout</code></dt> - <dd>A function that will be invoked, without any arguments, when the user logs out. This should tear down the user's session by making a call to the site's backend, or by redirecting the user.</dd> -</dl> - -<h3 id="Example" name="Example">示例</h3> - -<p>需要示例.</p> - -<h3 id="Specification" name="Specification">技术规范</h3> - -<p>没有包含在任何技术规范中.</p> - -<h3 id="查看其它内容">查看其它内容</h3> - -<ul> - <li><a href="/en/BrowserID" title="BrowserID">BrowserID</a></li> - <li>{{domxref("navigator.id")}}</li> - <li>{{domxref("navigator.id.logout()")}}</li> - <li>{{domxref("navigator.id.request()")}}</li> -</ul> |
