Passwort reset
This commit is contained in:
@ -1,30 +1,34 @@
|
||||
import React, { useState } from 'react'
|
||||
import toast, { Toaster } from 'react-hot-toast';
|
||||
import './ImportForm.css';
|
||||
import {wantNewPw} from '../services/PhpApi'
|
||||
import './InputForm.css';
|
||||
|
||||
function WantNewPw()
|
||||
{
|
||||
const [email, setEmail] = useState('');
|
||||
|
||||
const onChangeInput = (e: React.FormEvent<HTMLInputElement> ) => {
|
||||
const onChangeInput = (e: React.FormEvent<HTMLInputElement> ) =>
|
||||
{
|
||||
// console.log(e.currentTarget.value);
|
||||
setEmail(e.currentTarget.value);
|
||||
}
|
||||
|
||||
const submitForm = async (e: React.FormEvent<HTMLFormElement>) =>
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if(e.currentTarget.value.trim() !== '')
|
||||
{
|
||||
toast.error('Bitte Feld ausfüllen!');
|
||||
return;
|
||||
}
|
||||
// console.log(email);
|
||||
// console.log((e.currentTarget.elements[0] as HTMLInputElement).value);
|
||||
// if((e.currentTarget.elements[0] as HTMLInputElement).value.trim() === '')
|
||||
// {
|
||||
// toast.error('Bitte Feld ausfüllen!');
|
||||
// return;
|
||||
// }
|
||||
|
||||
const data = await wantNewPw(email);
|
||||
const data = await wantNewPw({email: email});
|
||||
if(data.success)
|
||||
{
|
||||
toast.success('Erfolgreich Passwort geändert!');
|
||||
e.currentTarget.reset();
|
||||
toast.success('Passwort angefordert! Bitte Postfach ' + email + ' checken!');
|
||||
//e.currentTarget.reset();
|
||||
}
|
||||
else if(!data.success && data.message)
|
||||
{
|
||||
|
||||
@ -267,7 +267,7 @@ export const wantNewPw = async ({email}:{email: string}) =>
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
return {success:0, message:'Password Reset Server Error!'};
|
||||
return {success:0, message:'Password Request Server Error!'};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user