Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Auto formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
sevrijss authored and actions-user committed Apr 20, 2023
1 parent c0ce6d1 commit 2ef664e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 51 deletions.
43 changes: 23 additions & 20 deletions frontend/components/loginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import Image from "next/image";
import filler_image from "@/public/filler_image.png";
import styles from "@/styles/Login.module.css";
import React, {FormEvent, useState} from "react";
import {useTranslation} from "react-i18next";
import {useRouter} from "next/router";
import React, { FormEvent, useState } from "react";
import { useTranslation } from "react-i18next";
import { useRouter } from "next/router";
import login from "@/lib/login";
import setSessionStorage from "@/lib/storage";
import {getRoleDirection} from "@/lib/reroute";
import {handleError} from "@/lib/error";
import { getRoleDirection } from "@/lib/reroute";
import { handleError } from "@/lib/error";
import Link from "next/link";
import IconButton from '@mui/material/IconButton';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
import InputAdornment from '@mui/material/InputAdornment';
import TextField from '@mui/material/TextField';
import IconButton from "@mui/material/IconButton";
import Visibility from "@mui/icons-material/Visibility";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
import InputAdornment from "@mui/material/InputAdornment";
import TextField from "@mui/material/TextField";
import PasswordInput from "@/components/password/passwordInput";


function LoginForm() {
const {t} = useTranslation();
const { t } = useTranslation();
const router = useRouter();
const [username, setUsername] = useState<string>("");
const [password, setPassword] = useState<string>("");
Expand Down Expand Up @@ -48,7 +47,7 @@ function LoginForm() {
return (
<form onSubmit={handleSubmit}>
<div className="d-flex align-items-center mb-3 pb-1">
<i className="fas fa-cubes fa-2x me-3"/>
<i className="fas fa-cubes fa-2x me-3" />
<span className="h1 fw-bold mb-0">Login.</span>
</div>
{router.query.createdAccount && (
Expand Down Expand Up @@ -78,10 +77,15 @@ function LoginForm() {
/>
</div>

<PasswordInput value={password} setPassword={setPassword}
handlePasswordVisibility={handlePasswordVisibility} showPassword={showPassword}
label={"Wachtwoord"}
placeholder={"Wachtwoord"} showIconButton={true}></PasswordInput>
<PasswordInput
value={password}
setPassword={setPassword}
handlePasswordVisibility={handlePasswordVisibility}
showPassword={showPassword}
label={"Wachtwoord"}
placeholder={"Wachtwoord"}
showIconButton={true}
></PasswordInput>

<div className="pt-1 mb-4">
<button className={`btn btn-dark btn-lg btn-block ${styles.button}`} type="submit">
Expand All @@ -94,13 +98,12 @@ function LoginForm() {
</a>
<p className="mb-5 pb-lg-2">
Heb je nog geen account?{" "}
<Link href="/signup" style={{textDecoration: "underline"}}>
<Link href="/signup" style={{ textDecoration: "underline" }}>
Registreer je hier!
</Link>
</p>
</form>
)
;
);
}

export default LoginForm;
44 changes: 22 additions & 22 deletions frontend/components/password/passwordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import IconButton from '@mui/material/IconButton';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
import React from "react";
import IconButton from "@mui/material/IconButton";
import Visibility from "@mui/icons-material/Visibility";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
import styles from "@/styles/Login.module.css";

interface PasswordInputProps {
Expand All @@ -17,16 +17,16 @@ interface PasswordInputProps {
}

const PasswordInput: React.FC<PasswordInputProps> = ({
value,
setPassword,
handlePasswordVisibility,
showPassword,
label,
placeholder,
showIconButton,
customOnInput,
customOnInvalid,
}) => {
value,
setPassword,
handlePasswordVisibility,
showPassword,
label,
placeholder,
showIconButton,
customOnInput,
customOnInvalid,
}) => {
const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {
setPassword(e.target.value);
if (customOnInput) {
Expand All @@ -45,28 +45,28 @@ const PasswordInput: React.FC<PasswordInputProps> = ({
return (
<div className={`form-outline mb-4`}>
<label className="form-label">{label}</label>
<div style={{position: 'relative'}}>
<div style={{ position: "relative" }}>
<input
type={showPassword ? 'text' : 'password'}
type={showPassword ? "text" : "password"}
className={`form-control form-control-lg ${styles.input}`}
value={value}
onInput={handleInput}
onInvalid={handleInvalid}
required
placeholder={placeholder}
style={{paddingRight: '40px'}}
style={{ paddingRight: "40px" }}
/>
{showIconButton && (
<IconButton
onClick={handlePasswordVisibility}
style={{
position: 'absolute',
top: '50%',
right: '40px',
transform: 'translateY(-50%)',
position: "absolute",
top: "50%",
right: "40px",
transform: "translateY(-50%)",
}}
>
{showPassword ? <Visibility/> : <VisibilityOff/>}
{showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton>
)}
</div>
Expand Down
16 changes: 7 additions & 9 deletions frontend/pages/reset-password.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {useRouter} from "next/router";
import React, {FormEvent, useState} from "react";
import { useRouter } from "next/router";
import React, { FormEvent, useState } from "react";
import BaseHeader from "@/components/header/baseHeader";
import styles from "@/styles/Login.module.css";
import Image from "next/image";
import filler_image from "@/public/filler_image.png";
import reset from "@/lib/reset";
import {Button} from "bootstrap";
import { Button } from "bootstrap";

export default function ResetPassword() {
const router = useRouter();
Expand All @@ -28,20 +28,20 @@ export default function ResetPassword() {

return (
<>
<BaseHeader/>
<BaseHeader />
<div className="container py-5 h-100">
<div className="row d-flex justify-content-center align-items-center h-100">
<div className="col col-xl-10">
<div className="card">
<div className="row g-0">
<div className="col-md-6 col-lg-5 d-none d-md-block">
<Image src={filler_image} alt="My App Logo" className={styles.filler_image}/>
<Image src={filler_image} alt="My App Logo" className={styles.filler_image} />
</div>
<div className="col-md-6 col-lg-7 d-flex align-items-center">
<div className="card-body p-4 p-lg-5 text-black">
<form>
<div className="d-flex align-items-center mb-3 pb-1">
<i className="fas fa-cubes fa-2x me-3"/>
<i className="fas fa-cubes fa-2x me-3" />
<span className="h1 fw-bold mb-0">Wachtwoord vergeten.</span>
</div>

Expand All @@ -60,9 +60,7 @@ export default function ResetPassword() {
placeholder="[email protected]"
/>
</div>
<button onClick={handleSubmit}>
Reset
</button>
<button onClick={handleSubmit}>Reset</button>
<p className="mb-5 pb-lg-2">
Geheugen opgefrist? <a href="/login">Ga naar login</a>
</p>
Expand Down

0 comments on commit 2ef664e

Please sign in to comment.