mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Certificate Wizard: Remove dead code, cleanup style
This commit is contained in:
parent
5fc231cda4
commit
6fa73e073f
3 changed files with 20 additions and 41 deletions
|
@ -39,11 +39,11 @@ void AddCertificateDialog::showErrorMessage(const QString message)
|
|||
ui->labelErrorCertif->setText(message);
|
||||
}
|
||||
|
||||
void AddCertificateDialog::Reinit()
|
||||
void AddCertificateDialog::reinit()
|
||||
{
|
||||
ui->labelErrorCertif->setText("");
|
||||
ui->lineEditCertificatePath->setText("");
|
||||
ui->lineEditPWDCertificate->setText("");
|
||||
ui->labelErrorCertif->clear();
|
||||
ui->lineEditCertificatePath->clear();
|
||||
ui->lineEditPWDCertificate->clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
QString getCertificatePath();
|
||||
QString getCertificatePasswd();
|
||||
void showErrorMessage(const QString message);
|
||||
void Reinit();
|
||||
void reinit();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonBrowseCertificate_clicked();
|
||||
|
|
|
@ -288,6 +288,15 @@ void OwncloudSetupPage::slotAskSSLClientCertificate()
|
|||
connect(addCertDial, SIGNAL(accepted()),this,SLOT(slotCertificateAccepted()));
|
||||
}
|
||||
|
||||
QString subjectInfoHelper(const QSslCertificate& cert, const QByteArray &qa)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
return cert.subjectInfo(qa);
|
||||
#else
|
||||
return cert.subjectInfo(qa).join(QLatin1Char('/'));
|
||||
#endif
|
||||
}
|
||||
|
||||
//called during the validation of the client certificate.
|
||||
void OwncloudSetupPage::slotCertificateAccepted()
|
||||
{
|
||||
|
@ -301,44 +310,14 @@ void OwncloudSetupPage::slotCertificateAccepted()
|
|||
QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(ba, QSsl::Pem);
|
||||
sslCertificate = sslCertificateList.takeAt(0);
|
||||
|
||||
this->_ocWizard->ownCloudCertificate = ba;
|
||||
this->_ocWizard->ownCloudPrivateKey = certif.PrivateKey.c_str();
|
||||
this->_ocWizard->ownCloudCertificatePath = addCertDial->getCertificatePath();
|
||||
this->_ocWizard->ownCloudCertificatePasswd = addCertDial->getCertificatePasswd();
|
||||
_ocWizard->ownCloudCertificate = ba;
|
||||
_ocWizard->ownCloudPrivateKey = certif.PrivateKey.c_str();
|
||||
_ocWizard->ownCloudCertificatePath = addCertDial->getCertificatePath();
|
||||
_ocWizard->ownCloudCertificatePasswd = addCertDial->getCertificatePasswd();
|
||||
|
||||
//FIXME qknight: hacky code ahead
|
||||
AccountPtr acc = this->_ocWizard->account();
|
||||
AccountPtr acc = _ocWizard->account();
|
||||
acc->setCertificate(_ocWizard->ownCloudCertificate, _ocWizard->ownCloudPrivateKey);
|
||||
|
||||
QList<QByteArray> qba = sslCertificate.subjectInfoAttributes();
|
||||
QString _DN = "";
|
||||
QString _C,_ST, _L, _O, _OU, _CN, _emailAddress;
|
||||
foreach(QByteArray qa, qba)
|
||||
{
|
||||
if(strcmp(qa.data(),"C")==0){
|
||||
_C="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"ST")==0){
|
||||
_ST="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"L")==0){
|
||||
_L="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"O")==0){
|
||||
_O="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"OU")==0){
|
||||
_OU="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"CN")==0){
|
||||
_CN="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
else if(strcmp(qa.data(),"emailAddress")==0){
|
||||
_emailAddress="/"+QString(qa)+"="+sslCertificate.subjectInfo(qa).join('/');
|
||||
}
|
||||
}
|
||||
_DN += _C+_ST+_L+_O+_OU+_CN+_emailAddress;
|
||||
addCertDial->Reinit();
|
||||
addCertDial->reinit();
|
||||
validatePage();
|
||||
} else {
|
||||
QString message;
|
||||
|
|
Loading…
Reference in a new issue