mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
@ -340,6 +340,7 @@ setup:
|
||||
sshKeyUserProvided:
|
||||
public: Public Key -
|
||||
private: Private Key -
|
||||
password: Password
|
||||
cloning: Cloning ...
|
||||
host:
|
||||
title: Select a Git Hosting Provider -
|
||||
|
@ -118,7 +118,7 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
|
||||
Navigator.of(context).push(route);
|
||||
}
|
||||
|
||||
void _updateKeys(String publicKey, String privateKey) {
|
||||
void _updateKeys(String publicKey, String privateKey, String password) {
|
||||
var settings = Provider.of<Settings>(context, listen: false);
|
||||
|
||||
if (publicKey.isEmpty || privateKey.isEmpty) {
|
||||
@ -126,6 +126,7 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
|
||||
}
|
||||
settings.sshPublicKey = publicKey;
|
||||
settings.sshPrivateKey = privateKey;
|
||||
settings.sshPassword = password;
|
||||
settings.save();
|
||||
|
||||
Navigator.of(context).pop();
|
||||
|
@ -209,11 +209,12 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
);
|
||||
} else if (_keyGenerationChoice == KeyGenerationChoice.UserProvided) {
|
||||
return GitHostUserProvidedKeys(
|
||||
doneFunction: (String publicKey, String privateKey) async {
|
||||
doneFunction:
|
||||
(String publicKey, String privateKey, String password) async {
|
||||
var settings = Provider.of<Settings>(context, listen: false);
|
||||
settings.sshPublicKey = publicKey;
|
||||
settings.sshPrivateKey = privateKey;
|
||||
settings.sshPassword = "";
|
||||
settings.sshPassword = password;
|
||||
settings.save();
|
||||
|
||||
setState(() {
|
||||
@ -295,11 +296,11 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
);
|
||||
} else if (_keyGenerationChoice == KeyGenerationChoice.UserProvided) {
|
||||
return GitHostUserProvidedKeys(
|
||||
doneFunction: (String publicKey, String privateKey) async {
|
||||
doneFunction: (publicKey, privateKey, password) async {
|
||||
var settings = Provider.of<Settings>(context, listen: false);
|
||||
settings.sshPublicKey = publicKey;
|
||||
settings.sshPrivateKey = privateKey;
|
||||
settings.sshPassword = "";
|
||||
settings.sshPassword = password;
|
||||
settings.save();
|
||||
|
||||
setState(() {
|
||||
|
@ -204,7 +204,8 @@ class GitHostSetupKeyChoice extends StatelessWidget {
|
||||
}
|
||||
|
||||
class GitHostUserProvidedKeys extends StatefulWidget {
|
||||
final Func2<String, String, void> doneFunction; // public, private
|
||||
final Func3<String, String, String, void>
|
||||
doneFunction; // public, private, password
|
||||
final String saveText;
|
||||
|
||||
GitHostUserProvidedKeys({
|
||||
@ -222,6 +223,7 @@ class _GitHostUserProvidedKeysState extends State<GitHostUserProvidedKeys> {
|
||||
GlobalKey<FormState> _privateFormKey;
|
||||
TextEditingController _publicKeyController;
|
||||
TextEditingController _privateKeyController;
|
||||
TextEditingController _passwordController;
|
||||
|
||||
String saveText;
|
||||
|
||||
@ -233,6 +235,7 @@ class _GitHostUserProvidedKeysState extends State<GitHostUserProvidedKeys> {
|
||||
_privateFormKey = GlobalKey<FormState>();
|
||||
_publicKeyController = TextEditingController();
|
||||
_privateKeyController = TextEditingController();
|
||||
_passwordController = TextEditingController();
|
||||
|
||||
saveText = widget.saveText.isEmpty ? tr("setup.next") : widget.saveText;
|
||||
}
|
||||
@ -263,6 +266,16 @@ class _GitHostUserProvidedKeysState extends State<GitHostUserProvidedKeys> {
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
PrivateKeyEditor(_privateFormKey, _privateKeyController),
|
||||
const SizedBox(height: 8.0),
|
||||
TextField(
|
||||
controller: _passwordController,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
helperText: tr('setup.sshKeyUserProvided.password'),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
GitHostSetupButton(
|
||||
text: saveText,
|
||||
@ -284,7 +297,11 @@ class _GitHostUserProvidedKeysState extends State<GitHostUserProvidedKeys> {
|
||||
privateKey += '\n';
|
||||
}
|
||||
|
||||
widget.doneFunction(publicKey, privateKey);
|
||||
widget.doneFunction(
|
||||
publicKey,
|
||||
privateKey,
|
||||
_passwordController.text,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user