--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MCCredentialsRequest.st Sun Aug 26 14:41:49 2018 +0200
@@ -0,0 +1,91 @@
+"{ Package: 'stx:goodies/monticello' }"
+
+"{ NameSpace: Smalltalk }"
+
+Notification subclass:#MCCredentialsRequest
+ instanceVariableNames:'username password url'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'SCM-Monticello-RemoteRepositories'
+!
+
+MCCredentialsRequest comment:'I am used to prompt in a UI indepentent way for a username and a password.
+If the user successfully entered the two strings I return an MCServerCredential if not I return nil.'
+!
+
+
+!MCCredentialsRequest class methodsFor:'signalling'!
+
+signalUrl: aUrl
+ ^ self new
+ url: aUrl;
+ signal
+!
+
+signalUrl: aUrl username: username password: password
+ ^ self new
+ url: aUrl;
+ username: username;
+ password: password;
+ signal
+! !
+
+!MCCredentialsRequest methodsFor:'accessing'!
+
+password
+ ^ password
+!
+
+password: anObject
+ password := anObject
+!
+
+passwordMessagePrompt
+ ^ 'Please enter a password for ', self url asString
+!
+
+url
+ ^ url
+!
+
+url: anObject
+ url := anObject
+!
+
+userMessagePrompt
+ ^ 'Please enter a username for ', self url asString
+!
+
+username
+ ^ username
+!
+
+username: anObject
+ username := anObject
+! !
+
+!MCCredentialsRequest methodsFor:'exceptiondescription'!
+
+defaultAction
+
+ username := UIManager default
+ request: self userMessagePrompt
+ initialAnswer: self username
+ title: 'User' translated.
+ (username isNil or: [ username isEmpty ])
+ ifTrue: [ ^ nil ].
+ password := UIManager default
+ requestPassword: self passwordMessagePrompt.
+ ^ MCServerCredentials user: username password: password
+! !
+
+!MCCredentialsRequest class methodsFor:'documentation'!
+
+version
+ ^ '$Header$'
+!
+
+version_CVS
+ ^ '$Header$'
+! !
+