resetPasswordConfirm method
Implementation
@override
Future<void> resetPasswordConfirm(String userId, String secret, String newPassword) async {
logger.finest('resetPassword(userId:$userId, secret:$secret, newPassword:$newPassword)');
var getUserData = await HycopFactory.dataBase!
.getData('hycop_users', 'user=$userId')
.catchError((error, stackTrace) => throw HycopUtils.getHycopException(
error: error, defaultMessage: 'not exist account(userId:$userId) !!!'));
if (getUserData.isEmpty) {
logger.severe('getData error !!!');
throw const HycopException(message: 'getData failed !!!');
}
String dbSecret = getUserData['secret'] ?? "";
if (dbSecret != secret) {
logger.severe('not match secret-key !!!');
throw const HycopException(message: 'not match secret-key !!!');
}
getUserData['password'] = HycopUtils.stringToSha1(newPassword);
await HycopFactory.dataBase!.setData('hycop_users', 'user=$userId', getUserData).catchError(
(error, stackTrace) =>
throw HycopUtils.getHycopException(error: error, defaultMessage: 'setData Error !!!'));
}