mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
[CORL-220] Change email address (#2461)
* change email form * add update email mutation * validate new email addresses * add email verification callout * add translation strings * fix submit button logic * rename model methods * style email verifcation box * resend email verificatoin button * show success message on email resend * update user profile email * fix duplicate import * add change email spec * fix profile spacing * update snapshots * update snaps * add preventSubmit function to email change component * update business logic for profile updating * update logic for when users can update email or username * check for less specific duplicate email error * prevent sso-only users from editing email * only allow email and username edit if enabeld in local profile * use generic server error for cannot update profile * remove merge conflict * fix tests * extract logic to get auth integrations * fix merge error
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { GQLAuthIntegrations } from "../schema/__generated__/types";
|
||||
|
||||
interface Integration {
|
||||
enabled: boolean;
|
||||
targetFilter: {
|
||||
admin?: boolean;
|
||||
stream?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface AuthSettings {
|
||||
integrations: {
|
||||
[index: string]: Integration;
|
||||
};
|
||||
}
|
||||
|
||||
export default function enabledAuthenticationIntegrations(
|
||||
auth: AuthSettings,
|
||||
target?: "stream" | "admin"
|
||||
): string[] {
|
||||
if (auth.integrations) {
|
||||
return Object.keys(auth.integrations).filter(
|
||||
(key: keyof GQLAuthIntegrations) => {
|
||||
const { targetFilter, enabled } = auth.integrations[key];
|
||||
if (target) {
|
||||
return enabled && targetFilter[target];
|
||||
}
|
||||
return enabled && targetFilter.admin && targetFilter.stream;
|
||||
}
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
Reference in New Issue
Block a user