Feature/addsignupsignin (#83)

* first branch commit

* testing formik yup in react native

* made TextInput work with formik

* react native base form control working great removed formik

* adding the button logic

* fix stupid error when merging this commit and precending ones need to be rebased

* fix multiple merging issues

* functionnal login form setup in the app

* added translation support for LoginForm

* added a forgotten password and added translation fixes

* Renamed loginform to Signinform for better coherence

* v1 of signup form and finished a missing renamed for signinform

* errors messages are now displayed correctly

* removed unused helper text

* addded translations

* added a password complexity check

* added missing translations and a temporary implementation of the AuthentificationWiew

* PR diff preview quick fixes: Removed unused imports, auto format, removed unnecessary changes

* Front: Authentication View: Use toast as helper messages

* first branch commit

* testing formik yup in react native

* made TextInput work with formik

* react native base form control working great removed formik

* adding the button logic

* fix stupid error when merging this commit and precending ones need to be rebased

* fix multiple merging issues

* functionnal login form setup in the app

* added translation support for LoginForm

* added a forgotten password and added translation fixes

* Renamed loginform to Signinform for better coherence

* v1 of signup form and finished a missing renamed for signinform

* errors messages are now displayed correctly

* removed unused helper text

* addded translations

* added a password complexity check

* added missing translations and a temporary implementation of the AuthentificationWiew

* PR diff preview quick fixes: Removed unused imports, auto format, removed unnecessary changes

* Front: Authentication View: Use toast as helper messages

* removed a worng declaration

* fixed PR comments

Co-authored-by: Arthi-chaud <arthur.jamet@gmail.com>
This commit is contained in:
Clément Le Bihan
2022-10-23 08:49:49 +01:00
committed by GitHub
parent 0d17119cf4
commit 30d3be72b2
11 changed files with 859 additions and 366 deletions
+30
View File
@@ -5,6 +5,7 @@ import LessonHistory from "./models/LessonHistory";
import Song from "./models/Song";
import SongHistory from "./models/SongHistory";
import User from "./models/User";
import { translate } from "./i18n/i18n";
const delay = (seconds: number) => new Promise(resolve => setTimeout(resolve, seconds * 1000));
@@ -134,4 +135,33 @@ export default class API {
userId: 1
}];
}
/**
* Get the login information status
*
*/
static async checkSigninCredentials(username: string, password: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
setTimeout(() => {
if (username === "katerina" && password === "1234") {
return resolve("token signin");
}
return reject(translate("invalidCredentials"));
}, 1000);
});
};
/**
* Get the register information status
*/
static async checkSignupCredentials(username: string, password: string, email: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
setTimeout(() => {
if (username === "bluub") {
return reject(translate("usernameTaken"));
}
return resolve("token signup");
}, 1000);
});
}
}