loginByAccount static method
login by account and password.
Implementation
static Future<AuthResult> loginByAccount(String account, String password,
{AuthRequest? authData}) async {
var body =
jsonEncode({'account': account, 'password': Util.encrypt(password)});
final Result result = await post('/api/v2/login/account', body);
AuthResult authResult = AuthResult(result);
authResult.user = await createUser(result);
if (authData == null) {
return authResult;
} else {
if (authResult.code == 200) {
authData.token = authResult.user?.token ?? "";
return OIDCClient.authByToken(authData.token, authData);
} else {
return authResult;
}
}
}