CLASSROOMIO-T-126: Invite teacher and teacher can login

This commit is contained in:
Rotimi Best
2023-09-01 15:28:47 +01:00
parent 9d0fd56f05
commit 929edea63c
29 changed files with 498 additions and 74 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ export const blockedSubdomain = [
'apps',
'play',
'support',
'demo',
'help',
'teachers',
'church',
@@ -21,5 +22,5 @@ export const blockedSubdomain = [
'groups',
'academy',
'schools',
'training',
'training'
];
+5 -4
View File
@@ -1,19 +1,20 @@
export const SIGNUP_FIELDS = {
name: '',
email: '',
password: '',
confirmPassword: '',
confirmPassword: ''
};
export const RESET_FIELDS = {
password: '',
confirmPassword: '',
confirmPassword: ''
};
export const LOGIN_FIELDS = {
email: '',
password: '',
password: ''
};
export const FORGOT_PASSWORD_FIELDS = {
email: '',
email: ''
};
+3
View File
@@ -7,6 +7,7 @@ export const ROUTE = {
COURSE: '/course',
LOGIN: '/login',
SIGN_UP: '/signup',
INVITE_SIGNUP: '/invite',
PROFILE: '/profile',
PEOPLE: '/people',
DISCUSSIONS: '/discussions',
@@ -19,6 +20,7 @@ export const PUBLIC_ROUTES = [
`^${ROUTE.HOME}$`,
ROUTE.LOGIN,
ROUTE.SIGN_UP,
`^${ROUTE.INVITE_SIGNUP}/.*`,
ROUTE.FORGOT,
ROUTE.RESET,
`^${ROUTE.PAGES}/.*`,
@@ -29,6 +31,7 @@ export const PUBLIC_ROUTES = [
export const ROUTES_TO_HIDE_NAV = [
ROUTE.LOGIN,
ROUTE.SIGN_UP,
`^${ROUTE.INVITE_SIGNUP}/.*`,
ROUTE.FORGOT,
ROUTE.RESET,
ROUTE.ONBOARDING
@@ -0,0 +1,8 @@
import { ROUTES_TO_HIDE_NAV } from '$lib/utils/constants/routes';
export default (route: string): boolean => {
return ROUTES_TO_HIDE_NAV.some((publicRoute) => {
const regex = new RegExp(publicRoute, 'g');
return regex.test(route);
});
};
+1 -1
View File
@@ -96,7 +96,7 @@ const onboardingValidationSchema = {
export const getConfirmPasswordError = ({ password, confirmPassword }) => {
return password > 6 && confirmPassword > 6 && password !== confirmPassword
? 'Does not match password'
: null;
: undefined;
};
export const processErrors = (error, mapToId) => {
+4 -1
View File
@@ -54,6 +54,7 @@ export async function getOrganizations(userId) {
`
id,
profile_id,
role_id,
organization!organizationmember_organization_id_fkey (
id,
name,
@@ -67,6 +68,7 @@ export async function getOrganizations(userId) {
.eq('profile_id', userId);
const orgsArray = [];
if (Array.isArray(data) && data.length) {
data.forEach((orgMember) => {
orgsArray.push({
@@ -77,6 +79,7 @@ export async function getOrganizations(userId) {
theme: orgMember?.organization?.theme,
avatar_url: orgMember?.organization?.avatar_url,
memberId: orgMember?.id,
role_id: orgMember?.role_id,
landingpage: orgMember?.organization?.landingpage
});
});
@@ -173,7 +176,7 @@ export async function getCurrentOrg(siteName, justGet = false) {
if (!justGet) {
currentOrg.set(data[0]);
} else {
} else if (!isEmpty(data)) {
return data[0];
}
}
+1
View File
@@ -3,6 +3,7 @@ import type { MailService } from '@sendgrid/mail';
import { SENDGRID_API_KEY } from '$env/static/private';
export const SENDGRID_FROM = 'Rotimi Best <[email protected]>';
export const SENDGRID_FROM_HELP = 'ClassroomIO <[email protected]>';
export let sendgrid: MailService;
@@ -1,14 +1,17 @@
import { writable, derived } from 'svelte/store';
import { STEPS } from '../constants/quiz';
import type { Writable } from 'svelte/store';
import type { CurrentOrg } from '../types/org';
export const orgs = writable([]);
export const currentOrg = writable({
export const currentOrg: Writable<CurrentOrg> = writable({
id: '',
name: '',
shortName: '',
siteName: '',
avatar_url: '',
memberId: '',
role_id: '',
landingpage: {},
theme: ''
});
+11
View File
@@ -0,0 +1,11 @@
export interface CurrentOrg {
id: string;
name: string;
shortName: string;
siteName: string;
avatar_url: string;
memberId: string;
role_id: string;
landingpage: {};
theme: string;
}