Removed " " from login

This commit is contained in:
Tihanyi Marcell 2023-06-12 20:09:11 +02:00
parent 3857896d6c
commit e255182b93
2 changed files with 4 additions and 6 deletions

View File

@ -57,15 +57,13 @@ Future loginApi({
String nonceStr = await Provider.of<KretaClient>(context, listen: false) String nonceStr = await Provider.of<KretaClient>(context, listen: false)
.getAPI(KretaAPI.nonce, json: false); .getAPI(KretaAPI.nonce, json: false);
Nonce nonce = Nonce nonce = getNonce(nonceStr, username, instituteCode);
getNonce(nonceStr, '${username.replaceAll(' ', '')} ', instituteCode);
headers.addAll(nonce.header());
Map? res = await Provider.of<KretaClient>(context, listen: false) Map? res = await Provider.of<KretaClient>(context, listen: false)
.postAPI(KretaAPI.login, .postAPI(KretaAPI.login,
headers: headers, headers: headers,
body: User.loginBody( body: User.loginBody(
username: '${username.replaceAll(' ', '')} ', username: username,
password: password, password: password,
instituteCode: instituteCode, instituteCode: instituteCode,
)); ));
@ -84,7 +82,7 @@ Future loginApi({
.getAPI(KretaAPI.student(instituteCode)); .getAPI(KretaAPI.student(instituteCode));
Student student = Student.fromJson(studentJson!); Student student = Student.fromJson(studentJson!);
var user = User( var user = User(
username: '${username.replaceAll(' ', '')} ', username: username,
password: password, password: password,
instituteCode: instituteCode, instituteCode: instituteCode,
name: student.name, name: student.name,

View File

@ -169,7 +169,7 @@ class KretaClient {
Map? loginRes = await postAPI(KretaAPI.login, Map? loginRes = await postAPI(KretaAPI.login,
headers: headers, headers: headers,
body: User.loginBody( body: User.loginBody(
username: loginUser.username.replaceAll(' ', '') + ' ', username: loginUser.username,
password: loginUser.password, password: loginUser.password,
instituteCode: loginUser.instituteCode, instituteCode: loginUser.instituteCode,
)); ));