mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-22 22:30:05 +01:00
Fix validation issue with migration requests
This commit is contained in:
parent
eb05d39210
commit
a47975c46e
@ -110,7 +110,6 @@ public function update(TwoFAccountUpdateRequest $request, TwoFAccount $twofaccou
|
||||
*/
|
||||
public function migrate(TwoFAccountImportRequest $request)
|
||||
{
|
||||
$request->merge(['withSecret' => true]);
|
||||
$validated = $request->validated();
|
||||
|
||||
if (Arr::has($validated, 'file')) {
|
||||
|
@ -31,4 +31,18 @@ public function rules()
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'otp_type' => strtolower($this->otp_type),
|
||||
'algorithm' => strtolower($this->algorithm),
|
||||
]);
|
||||
}
|
||||
}
|
@ -36,4 +36,18 @@ public function rules()
|
||||
'counter' => 'nullable|integer|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'otp_type' => strtolower($this->otp_type),
|
||||
'algorithm' => strtolower($this->algorithm),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -36,4 +36,18 @@ public function rules()
|
||||
'counter' => 'nullable|integer|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'otp_type' => strtolower($this->otp_type),
|
||||
'algorithm' => strtolower($this->algorithm),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,17 @@ public function rules()
|
||||
'custom_otp' => 'string|in:steamtotp',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'custom_otp' => strtolower($this->custom_otp),
|
||||
]);
|
||||
}
|
||||
}
|
@ -163,8 +163,6 @@
|
||||
digits: null,
|
||||
counter: null,
|
||||
period: null,
|
||||
image: '',
|
||||
qrcode: null,
|
||||
}),
|
||||
uploadForm: new Form(),
|
||||
ShowTwofaccountInModal : false,
|
||||
@ -207,7 +205,7 @@
|
||||
this.migrationPayload = migrationPayload
|
||||
this.isFetching = true
|
||||
|
||||
await this.axios.post('/api/v1/twofaccounts/migration', {payload: this.migrationPayload}, {returnError: true}).then(response => {
|
||||
await this.axios.post('/api/v1/twofaccounts/migration', {payload: this.migrationPayload, withSecret: true}, {returnError: true}).then(response => {
|
||||
response.data.forEach((data) => {
|
||||
data.imported = -1;
|
||||
this.exportedAccounts.push(data)
|
||||
@ -320,6 +318,7 @@
|
||||
|
||||
let filedata = new FormData();
|
||||
filedata.append('file', this.$refs.fileInput.files[0]);
|
||||
filedata.append('withSecret', true);
|
||||
|
||||
this.uploadForm.upload('/api/v1/twofaccounts/migration', filedata, {returnError: true}).then(response => {
|
||||
response.data.forEach((data) => {
|
||||
@ -345,8 +344,9 @@
|
||||
|
||||
let imgdata = new FormData();
|
||||
imgdata.append('qrcode', this.$refs.qrcodeInput.files[0]);
|
||||
imgdata.append('withSecret', true);
|
||||
|
||||
this.form.upload('/api/v1/qrcode/decode', imgdata, {returnError: true}).then(response => {
|
||||
this.uploadForm.upload('/api/v1/qrcode/decode', imgdata, {returnError: true}).then(response => {
|
||||
this.migrate(response.data.data)
|
||||
})
|
||||
.catch(error => {
|
||||
|
Loading…
Reference in New Issue
Block a user