Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRONOTE]: Les code pin sont là ! #239

Merged
merged 9 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/components/Templates/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const LoginView: React.FC<{
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");

const [customFieldsInputs, setCustomFields] = useState<
const [customFieldsInputs, setCustomFieldsInputs] = useState<
LoginViewCustomInput[]
>(
customFields.map((field) => ({
Expand Down Expand Up @@ -214,7 +214,7 @@ const LoginView: React.FC<{
<TextInput
value={field.value}
onChangeText={(text) => {
setCustomFields(
setCustomFieldsInputs(
customFieldsInputs.map((f, i) => {
if (i === index) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/AlertProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type AlertAction = {
backgroundColor?: string;
};

type Alert = {
export type Alert = {
title: string;
message: string;
actions?: AlertAction[];
Expand Down
5 changes: 5 additions & 0 deletions src/router/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export type RouteParameters = {
nextTimeToken: string
}
};
Pronote2FA_Auth: {
session: pronote.SessionHandle,
error: pronote.SecurityError,
accountID: string
};

// login.ecoledirecte
EcoleDirecteCredentials: undefined;
Expand Down
5 changes: 5 additions & 0 deletions src/router/screens/login/pronote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PronoteManualURL from "@/views/login/pronote/PronoteManualURL";
import PronoteQRCode from "@/views/login/pronote/PronoteQRCode";
import PronoteWebview from "@/views/login/pronote/PronoteWebview";
import PronoteV6Import from "@/views/login/pronote/PronoteV6Import";
import Pronote2FA_Auth from "@/views/login/pronote/Pronote2FA_Auth";


export default [
Expand Down Expand Up @@ -56,4 +57,8 @@ export default [
headerTitle: "Importer d'une ancienne version",
presentation: "modal",
}),
createScreen("Pronote2FA_Auth", Pronote2FA_Auth, {
headerTitle: "Connexion à PRONOTE",
headerBackVisible: true
}),
] as const;
5 changes: 3 additions & 2 deletions src/services/pronote/determinate-authentication-view.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
import type { RouteParameters } from "@/router/helpers/types";
import { Check, KeyRound, LockKeyhole } from "lucide-react-native";
import { KeyRound, LockKeyhole } from "lucide-react-native";
import pronote from "pawnote";
import {info, warn} from "@/utils/logger/logger";
import type { Alert } from "@/providers/AlertProvider";

/**
* Va exécuter une requête pour déterminer
Expand All @@ -14,7 +15,7 @@ import {info, warn} from "@/utils/logger/logger";
const determinateAuthenticationView = async <ScreenName extends keyof RouteParameters>(
pronoteURL: string,
navigation: NativeStackNavigationProp<RouteParameters, ScreenName>,
showAlert: any // TODO: type
showAlert: (alert: Alert) => void
): Promise<void> => {
let instance: pronote.Instance | undefined;
pronoteURL = pronote.cleanURL(pronoteURL);
Expand Down
Loading