Fix recaptcha on login forms

This commit is contained in:
Dane Everitt 2019-12-15 18:05:44 -08:00
parent f864b72e0a
commit 66410a35f1
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 188 additions and 77 deletions

View file

@ -6,9 +6,19 @@ export interface LoginResponse {
confirmationToken?: string;
}
export default (user: string, password: string): Promise<LoginResponse> => {
export interface LoginData {
username: string;
password: string;
recaptchaData?: string | null;
}
export default ({ username, password, recaptchaData }: LoginData): Promise<LoginResponse> => {
return new Promise((resolve, reject) => {
http.post('/auth/login', { user, password })
http.post('/auth/login', {
user: username,
password,
'g-recaptcha-response': recaptchaData,
})
.then(response => {
if (!(response.data instanceof Object)) {
return reject(new Error('An error occurred while processing the login request.'));