Skip to content

Commit 3e4de95

Browse files
authored
Merge pull request #479 from hpi-swa-teaching/fix/GH-467
Add TFA
2 parents e6d70d1 + 8d38e24 commit 3e4de95

File tree

53 files changed

+243
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+243
-90
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
library calls
2+
checkAuthenticationPassword: aString
3+
4+
self core send: (TCCRequest newCheckAuthenticationPassword: aString).

packages/TelegramClient-Core.package/TCCAuthenticationHandler.class/instance/handleEvent..st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ handleEvent: anEvent
88
self isAwaitingDbEncryptionKey ifTrue: [self setDbEncryptionKey: ''].
99
self isAwaitingPhoneNumber ifTrue: [^ #awaitPhoneNumber].
1010
self isAwaitingAuthCode ifTrue: [^ #awaitAuthCode].
11+
self isAwaitingAuthPassword ifTrue: [^ #awaitAuthPassword].
1112
self isAuthorizationStateReady ifTrue: [^ self core authSucceeded].
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
isAwaitingAuthPassword
3+
4+
^ self authState = 'authorizationStateWaitPassword'

packages/TelegramClient-Core.package/TCCAuthenticationHandler.class/methodProperties.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"authState" : "R.S 5/18/2020 17:54",
77
"authState:" : "R.S 5/18/2020 17:54",
88
"checkAuthenticationCode:" : "RS 6/23/2021 16:35",
9+
"checkAuthenticationPassword:" : "aka 5/21/2022 10:33",
910
"core" : "per 5/21/2021 16:57",
1011
"core:" : "per 5/21/2021 16:57",
11-
"handleEvent:" : "JB 6/7/2021 11:15",
12+
"handleEvent:" : "aka 5/21/2022 11:33",
1213
"initialize" : "RS 4/28/2021 18:04",
1314
"isAuthStateClosed" : "r.s 7/15/2020 12:17",
1415
"isAuthorizationStateReady" : "r.s 7/15/2020 12:17",
1516
"isAwaitingAuthCode" : "r.s 7/15/2020 12:17",
17+
"isAwaitingAuthPassword" : "aka 5/21/2022 10:10",
1618
"isAwaitingDbEncryptionKey" : "8/5/2021 21:14:18",
1719
"isAwaitingPhoneNumber" : "r.s 7/15/2020 12:17",
1820
"isAwaitingTdlibParams" : "8/5/2021 21:14:18",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
handlers
2+
checkAuthenticationPassword: aString
3+
4+
self authenticationHandler checkAuthenticationPassword: aString.

packages/TelegramClient-Core.package/TCCCore.class/instance/tryHandleError..st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ tryHandleError: anError
55
['USERNAME_NOT_OCCUPIED'] -> [UIManager default inform: TCCErrorConstants unknownUsername].
66
['USERNAME_INVALID'] -> [UIManager default inform: TCCErrorConstants unknownUsername].
77
['PHONE_NUMBER_INVALID'] -> [UIManager default inform: TCCErrorConstants invalidAuthenticationCode].
8-
['PHONE_CODE_INVALID'] -> [UIManager default inform: TCCErrorConstants invalidAuthenticationCode]}
8+
['PHONE_CODE_INVALID'] -> [UIManager default inform: TCCErrorConstants invalidAuthenticationCode].
9+
['PASSWORD_HASH_INVALID'] -> [UIManager default inform: TCCErrorConstants invalidAuthenticationPassword]}
910
otherwise: [
1011
((anError at: 'message') beginsWith: 'Can''t lock file')
1112
ifTrue: [UIManager default inform: TCCErrorConstants tdlibAlreadyInUse]

packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"chatsHandler" : "rs 6/7/2020 21:50",
1212
"chatsHandler:" : "rs 6/7/2020 21:50",
1313
"checkAuthenticationCode:" : "RS 7/31/2021 15:56",
14+
"checkAuthenticationPassword:" : "aka 5/21/2022 11:31",
1415
"client" : "R.S 5/20/2020 16:08",
1516
"client:" : "pk 8/5/2021 16:39",
1617
"freeClient" : "6/9/2021 14:12:18",
@@ -35,7 +36,7 @@
3536
"send:thenDo:" : "JB 8/1/2021 11:26",
3637
"sendPhoneNumber:" : "RS 7/31/2021 15:57",
3738
"setUserId:" : "pk 8/5/2021 17:05",
38-
"tryHandleError:" : "JB 6/4/2021 17:28",
39+
"tryHandleError:" : "aka 5/21/2022 12:07",
3940
"update" : "pk 8/5/2021 17:09",
4041
"userStore" : "per 7/15/2021 12:56",
4142
"userStore:" : "tr 7/25/2021 17:57" } }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
messages
2+
invalidAuthenticationPassword
3+
4+
^ 'The password you entered seems to be invalid.'

packages/TelegramClient-Core.package/TCCErrorConstants.class/methodProperties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"class" : {
33
"invalidAuthenticationCode" : "r.s 7/31/2020 14:48",
4+
"invalidAuthenticationPassword" : "aka 5/21/2022 12:06",
45
"invalidPhoneNumber" : "r.s 7/31/2020 14:48",
56
"tdlibAlreadyInUse" : "r.s 7/31/2020 14:48",
67
"unknownUsername" : "r.s 7/31/2020 14:48" },
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
instance creation
2+
newCheckAuthenticationPassword: aString
3+
4+
^ TCCRequest
5+
newWithType: 'checkAuthenticationPassword'
6+
from: {'password' -> aString}

packages/TelegramClient-Core.package/TCCRequest.class/methodProperties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"class" : {
33
"newCheckAuthenticationCode:" : "RS 6/23/2021 16:35",
4+
"newCheckAuthenticationPassword:" : "aka 5/21/2022 10:34",
45
"newCheckDatabaseEncryptionKey:" : "RS 6/23/2021 16:35",
56
"newGetBasicGroupFullInfoOf:" : "JB 8/1/2021 18:17",
67
"newGetChatHistoryOf:from:until:" : "RS 6/24/2021 09:20",

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/buttonBack..st

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/buttonBack.st

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/buttonBackPressed.st

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonCancel: aButton
3+
4+
buttonCancel := aButton.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonCancel
3+
4+
^ buttonCancel
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
event handling
2+
buttonCancelPressed
3+
4+
self showPhoneNumberStep.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/buttonVerify..st

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/buttonVerify.st

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonVerifyAuthCode: aButton
3+
4+
buttonVerifyAuthCode := aButton.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonVerifyAuthCode
3+
4+
^ buttonVerifyAuthCode
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
event handling
2-
buttonVerifyPressed
2+
buttonVerifyAuthCodePressed
33

44
self core checkAuthenticationCode: self inputField text.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonVerifyAuthPassword: aButton
3+
4+
buttonVerifyAuthPassword := aButton
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
buttonVerifyAuthPassword
3+
4+
^ buttonVerifyAuthPassword
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
event handling
2+
buttonVerifyAuthPasswordPressed
3+
4+
self core checkAuthenticationPassword: self passwordField text.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/createButtonBack.st

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
initialization
2+
createButtonCancel
3+
4+
self
5+
buttonCancel: (TCUButton new
6+
text: 'Cancel';
7+
center: self inputField center + ((-100) @ 50);
8+
hide;
9+
on: #mouseDown send: #buttonCancelPressed to: self;
10+
yourself);
11+
addMorph: self buttonCancel.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/createButtonVerify.st

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
initialization
2+
createButtonVerifyAuthCode
3+
4+
self
5+
buttonVerifyAuthCode: (TCUButton new
6+
text: 'Verify';
7+
center: self inputField center + (70 @ 50);
8+
on: #mouseDown send: #buttonVerifyAuthCodePressed to: self;
9+
hide;
10+
yourself);
11+
addMorph: self buttonVerifyAuthCode.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
initialization
2+
createButtonVerifyAuthPassword
3+
4+
self
5+
buttonVerifyAuthPassword: (TCUButton new
6+
text: 'Verify';
7+
center: self inputField center + (70 @ 50);
8+
on: #mouseDown send: #buttonVerifyAuthPasswordPressed to: self;
9+
hide;
10+
yourself);
11+
addMorph: self buttonVerifyAuthPassword.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/createInputField..st renamed to packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/createInputField.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
initialization
2-
createInputField: aString
2+
createInputField
33

44
self
55
inputField: (TextMorph new
6-
contentsWrapped: aString asText;
6+
contentsWrapped: '';
77
extent: self class defaultInputWidth @ 50;
88
borderColor: TCUDefaultValues colorGray;
99
borderWidth: 1;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
initialization
2+
createPasswordField
3+
4+
self
5+
passwordField: (TextMorph new
6+
contentsWrapped: '';
7+
extent: self class defaultInputWidth @ 50;
8+
borderColor: TCUDefaultValues colorGray;
9+
borderWidth: 1;
10+
center: self instructionLabel center + (0 @ 30);
11+
hide;
12+
yourself);
13+
addMorph: self passwordField.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/initializeMorphs.st

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ initialization
22
initializeMorphs
33

44
self
5-
createInputField: '+49';
5+
createInputField;
66
createButtonNext;
77
createErrorLabel: '';
8-
createButtonBack;
9-
createButtonVerify.
8+
createButtonCancel;
9+
createButtonVerifyAuthCode;
10+
createButtonVerifyAuthPassword;
11+
createPasswordField.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
passwordField: aTextMorph
3+
4+
passwordField := aTextMorph
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
passwordField
3+
4+
^ passwordField
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
drawing
2-
showSecondStep
2+
showAuthCodeStep
33

44
self buttonNext hide.
5-
self buttonBack show.
6-
self buttonVerify show.
7-
5+
self buttonCancel show.
6+
self buttonVerifyAuthCode show.
7+
88
self instructionLabel
99
contents: 'Enter the code your received on your phone';
1010
center: self center.
1111

1212
self inputField
1313
contents: '';
14-
crAction: [self buttonVerifyPressed].
14+
show;
15+
crAction: [self buttonVerifyAuthCodePressed].
1516
self errorLabel hide.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
drawing
2+
showAuthPasswordStep
3+
4+
self buttonVerifyAuthCode hide.
5+
self buttonCancel show.
6+
self buttonVerifyAuthPassword show.
7+
self inputField hide.
8+
9+
self instructionLabel
10+
contents: 'Enter your password';
11+
center: self center.
12+
13+
self passwordField
14+
contents: '';
15+
show;
16+
crAction: [self buttonVerifyAuthPasswordPressed].
17+
self errorLabel hide.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
drawing
2-
showFirstStep
3-
2+
showPhoneNumberStep
3+
4+
self passwordField hide.
5+
self buttonVerifyAuthPassword hide.
6+
self buttonVerifyAuthCode hide.
7+
self buttonCancel hide.
8+
49
self instructionLabel
510
contents: 'Enter your telephone number: ' asText;
611
center: self center.
712

8-
self buttonVerify hide.
913
self inputField
1014
show;
15+
contents: '+49';
1116
crAction: [self buttonNextPressed].
1217
self buttonNext show.
1318
self instructionLabel show.

packages/TelegramClient-UI.package/TCUAuthenticationWindow.class/instance/subscribeCore.st

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ core communication
22
subscribeCore
33

44
self core
5-
when: #awaitPhoneNumber send: #showFirstStep to: self;
6-
when: #awaitAuthCode send: #showSecondStep to: self;
5+
when: #awaitPhoneNumber send: #showPhoneNumberStep to: self;
6+
when: #awaitAuthCode send: #showAuthCodeStep to: self;
7+
when: #awaitAuthPassword send: #showAuthPasswordStep to: self;
78
when: #authReady send: #logInCompleted to: self.

0 commit comments

Comments
 (0)