mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add authSubject and authProvider to sessions
Summary: This also updates Authorizer to link the authSubject to Grist users if not previously linked. Linked subjects are now used as the username for password-based logins, instead of emails, which remain as a fallback. Test Plan: Existing tests, and tested login flows manually. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3356
This commit is contained in:
@@ -32,7 +32,7 @@ export function configForUser(username: string): AxiosRequestConfig {
|
||||
export async function createUser(dbManager: HomeDBManager, name: string): Promise<Organization> {
|
||||
const username = name.toLowerCase();
|
||||
const email = `${username}@getgrist.com`;
|
||||
const user = await dbManager.getUserByLogin(email, {email, name});
|
||||
const user = await dbManager.getUserByLogin(email, {profile: {email, name}});
|
||||
if (!user) { throw new Error('failed to create user'); }
|
||||
user.apiKey = `api_key_for_${username}`;
|
||||
await user.save();
|
||||
|
||||
Reference in New Issue
Block a user