[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:
Tessa Thornton
2019-08-20 12:28:14 -04:00
committed by GitHub
parent 0f02b05689
commit ee93267d97
18 changed files with 1016 additions and 69 deletions
@@ -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 [];
}