Exemplo n.º 1
0
/**
 * @brief LoginDialog::urlChanged
 * @param url \n
 *  If we succesfully get a Auth code in our URL we extract the code here and emit  LoginDialog::AuthCodeObtained signal
 * http://www.freesound.org/docs/api/authentication.html#oauth2-authentication
 */
void LoginDialog::urlChanged(const QUrl &url)
{
    //qDebug() << "URL =" << url;
    QString str = url.toString();
    int posCode = str.indexOf("&code=");
    int posErr = str.indexOf("&error=");
    if(posCode != -1)
    {

        m_strAuthCode =str.mid(posCode+6) ;
        emit AuthCodeObtained();
        QDialog::accept();

    }
    if(posErr != -1)
    {

        QString sError =str.mid(posErr+7) ;
        if (sError=="access_denied" )
        {
            emit accessDenied();
        }
        QDialog::accept();

    }
}
Exemplo n.º 2
0
struct edwScriptRegistry *edwScriptRegistryFromCgi()
/* Get script registery from cgi variables.  Does authentication too. */
{
struct sqlConnection *conn = edwConnect();
char *user = sqlEscapeString(cgiString("user"));
char *password = sqlEscapeString(cgiString("password"));
char query[256];
sqlSafef(query, sizeof(query), "select * from edwScriptRegistry where name='%s'", user);
struct edwScriptRegistry *reg = edwScriptRegistryLoadByQuery(conn, query);
if (reg == NULL)
    accessDenied();
char key[EDW_SID_SIZE];
edwMakeSid(password, key);
if (!sameString(reg->secretHash, key))
    accessDenied();
sqlDisconnect(&conn);
return reg;
}
ResetWidget::ResetWidget (
        ResetBusinessLogic     *resetBusinessLogic, 
        QGraphicsWidget        *parent) :
    DcpWidget (parent),
    m_ResetBusinessLogic (resetBusinessLogic),
    m_currentPlan (None)
{
    createContent();

    connect (resetBusinessLogic, SIGNAL (gotAccess ()),
             this, SLOT (doTheWork ()));
    connect (resetBusinessLogic, SIGNAL (accessDenied ()),
             this, SLOT (operationCancelled ()));
}