mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-08 07:00:54 +03:00
10
app/user.js
10
app/user.js
@@ -54,12 +54,12 @@ export default class User {
|
||||
return this.loggedIn ? LIMITS.MAX_DOWNLOADS : LIMITS.ANON.MAX_DOWNLOADS;
|
||||
}
|
||||
|
||||
async login() {
|
||||
async login(email) {
|
||||
const state = arrayToB64(crypto.getRandomValues(new Uint8Array(16)));
|
||||
storage.set('oauthState', state);
|
||||
const keys_jwk = await prepareScopedBundleKey(this.storage);
|
||||
const code_challenge = await preparePkce(this.storage);
|
||||
const params = new URLSearchParams({
|
||||
const options = {
|
||||
client_id: AUTH_CONFIG.client_id,
|
||||
code_challenge,
|
||||
code_challenge_method: 'S256',
|
||||
@@ -67,7 +67,11 @@ export default class User {
|
||||
scope: 'profile https://identity.mozilla.com/apps/send', //TODO param
|
||||
state,
|
||||
keys_jwk
|
||||
});
|
||||
};
|
||||
if (email) {
|
||||
options.email = email;
|
||||
}
|
||||
const params = new URLSearchParams(options);
|
||||
location.assign(
|
||||
`${AUTH_CONFIG.authorization_endpoint}?${params.toString()}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user