Skip to content

Commit

Permalink
Merge pull request #239 from Gabriel29306/pin-auth
Browse files Browse the repository at this point in the history
[PRONOTE]: Les code pin sont là !
  • Loading branch information
ecnivtwelve authored Oct 1, 2024
2 parents b1ef029 + ac9994e commit d582132
Show file tree
Hide file tree
Showing 9 changed files with 372 additions and 28 deletions.
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 @@ -39,6 +39,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;
if (!pronoteURL.startsWith("https://") && !pronoteURL.startsWith("http://")) {
Expand Down
Loading

0 comments on commit d582132

Please sign in to comment.