Azure / Azure/static-web-apps-cli
Auth Emulator - Indicate valid Username characters when invalid character(s) submitted
- 主要言語
- TypeScript
- スター
- 668
- フォーク
- 156
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
**Is your feature request related to a problem? Please describe.**
Using the Auth Emulator page for GitHub (may be the same for other Identity Providers):
http://localhost:4280/.auth/login/github
If the user enters invalid characters for `Username`, an attempt to submit the form fails "silently" in the UI.
Example value for `Username`:
`یونیکد`
The console gives additional information:
_The string to be encoded contains characters outside of the Latin1 range._
`
Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
at saveCookie (http://localhost:4280/.auth/login/github:168:54)
at HTMLFormElement. (http://localhost:4280/.auth/login/github:316:11)
at HTMLFormElement.dispatch (https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.2.1.min.js:3:10316)
at HTMLFormElement.q.handle (https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.2.1.min.js:3:8343)
`
**Describe the solution you'd like**
If it is required that Username characters be in the Latin1 range, add a validation message near the Username field in the UI.
If the full range of Unicode characters is allowed, adjust logic, to allow such characters.
**Describe alternatives you've considered**
Open the DevTools Console while running, to view run-time exceptions
**Additional context**
Exception is thrown in this source code file:
https://github.com/Azure/static-web-apps-cli/blob/main/src/public/auth.html
```Javascript
function saveCookie(formElement) {
const data = localStorage[hashStorageKey(formElement)];
document.cookie = `StaticWebAppsAuthCookie=${btoa(data)}; path=/`;
}
```
コントリビューションガイド
調査の方向性
src/public/auth.html から開始し、特に saveCookie と、issue に示されている Username フォームの送信経路を確認してください。提供された Unicode 値で失敗を再現し、現在のフィールド検証と btoa 呼び出しを調べてください。UI が暗黙に失敗しなくなれば完了です。つまり、受け入れ可能な Username の文字を説明するか、プロジェクトが想定する範囲全体をサポートします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- authentication, frontend
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100