Sonata-Project's Google Authenticator: Undefined Method "getTwoStepVerificationCode" from Application\Sonata\UserBundle\Entity\User - sonata-admin

guys!
I am currently working on a project built on Symfony 2.8 and a few Sonata-Project bundles. The goal is to achieve Two-Factor Authentication (a.k.a Two-Step Verification). I saw that Sonata-Project has a package for implementing such functionality and installed it. Then configured the app/config/config.yml file according to sonata's documentation, but when I try to log into my Dashboard from the login form, I do that without any further obstacles (no 2-Factor Authentication Prompt). Here, on stackoverflow.com, I've seen a few answers, (not-fully) related to my question, that suggest running php app/console sonata:user:two-step-verification *ADMIN_USER_NAME*. I've tried to run this command in my terminal, but got this exception thrown:
[Symfony\Component\Debug\Exception\UndefinedMethodException]
Attempted to call an undefined method named "getTwoStepVerificationCode" of class
"Application\Sonata\UserBundle\Entity\User".
What seems to be the problem here? Why such method doesn't exist? How can I resolve this issue?
P.S.: I try to use this Google-Authenticator package in conjunction with Soanata-Project's UserBundle as it is "a feature" (if I may call it such) of the latter.

Does your application properly extend Sonata\UserBundle\Entity\BaseUser? Because if not you will have this issue. Check your class Application\Sonata\UserBundle\Entity\User.

Related

NoSuchMethodError exception on SSLSocketImpl.receivedChangeCipherSpec when using javapns in GAE

I am using javapns with Google App Engine. Everything was working fine until this morning. Now, it raises this exception:
java.lang.NoSuchMethodError: sun.security.ssl.SSLSocketImpl.receivedChangeCipherSpec()Z
at sun.security.ssl.Handshaker.receivedChangeCipherSpec(Handshaker.java:356)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:347)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:901)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:837)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1026)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1324)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:712)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
at java.io.OutputStream.write(OutputStream.java:75)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320)
at javapns.Push.sendPayload(Push.java:177)
at javapns.Push.payload(Push.java:149)
Any idea? I have seen the missing method in JDK7u but I think I am using JDK7. Not sure if this is related.
I contacted Google Support regarding this issue and got the following response:
This is a known issue that is already resolved.
They did not disclosure the root cause.
I was trying to use the BigTable client and ran into the same issue. It's due to the Google API using HTTP2 with TLS. The ALPN library used to support TLS modifies the bytecode on boot up and is tightly coupled with the version of the JRE/JDK you are running. Check the "Versions" table at http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html to match the specific version of ALPN to your JRE and you should be good.

Grails dbm-changelog-sync No such property

I am building a Grails app and was asked to integrate with liquibase. After a bit of research I found that the Database Migration plugin is the preferred method for this.
However, whenever I run any command involving the plugin, I get the following error:
Error executing script DbmChangelogSync: No such property: database for class: _DatabaseMigrationCommon_groovy
I am using database-migration version 1.3.6. I also tried with 1.3.8 but received the same error.
Any advice? Thanks.

Problems using Twitter4j on GAE throws 401 just after deploy

Well, I'm having a weird error here:
I'm developing one GAE app to read some Twitter Data, and after read a lot of docs, I have it working on my test server (Running on my pc) but after deploy and test on the real (my appspot domain) it shows this message:
401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or >incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the >system clock is in sync.
message - Could not authenticate you
code - 32
I've tried to recreate my OAuthAppToken and OAuthAppTokenSecret keys, even changing the permissions to "Write, Read and Direct Messages" and even assingning one Callback URL but nothing seems to work...
I've tried using twitter4j.properties OR using setOAuthConsumer(TW_CONSUMER_KEY, TW_CONSUMER_SECRET) OR a ConfigurationBuilder whith the correct constants and I'm experimenting the same Issue.
I'm working with AppEngine 1.8.3 and Twitter4j 3.0.4
Iv'e been writing on log and the Twitter object seems to be well created... I dont understand why is working on my PC but not on the real app.
On some other post someone says that could be because it needs to use Sync clock.. but he doesn't explains where to change that property...
Did someone had a clue?
Ok, the problem was me (and Twitter.... well..... I really think it was Twitter problem for being so dark on his api messages)...
On testing server I was looking for an existing account and on the cloud I was looking for an inexistent one. So, It was my mistake. But seriously, what about Twitter saying: "Access Forbidden"? That doesn't have any sense...

how i can disable cakephp Test Suite?

do you test this url in your application that writted with cakephp ?
www.yourCakephpApp.com/test
you see a page like this:
http://www.eliteprojects.org/cake/app/webroot/test.php
how i can disable test suite?
You access CakePHP's built-in test suite's web runner by going to /yourapp/test.php or /test.php, depending on your server's configuration. Going to /test should give you a 404 error unless you specifically added such a route or a file/path named test in your webroot directory.
You can disable the web runner by denying access to it in your server configurations or by simply removing the file. However, there's rarely a reason to do this, as:
A major part of CakePHP's development platform is its comprehensive testing support. It would be like using CakePHP and removing the bake console.
The test runner is designed to be accessible only during development. So unless you're using a debug mode > 0 in production (which you shouldn't be doing), the web runner won't be accessible from that URL.
Lastly, if you're new to Cake, you need to read the Cake cookbook. Start from the first section, and work your way down to the Blog Tutorial. This will answer most of your questions and avoid a lot of common mistakes (such as your misconfiguring your server's docroot and not having URL rewriting set up properly).
Note:
I've bolded the part about the Cookbook because it is such a crucial resource for learning Cake development, and it's the first place you should consult if you run into any problems or have a question. In fact, people get quite annoyed on #cakephp at new users asking the same basic questions that are already answered in the Cookbook—especially if you haven't done the Blog Tutorial.
It should never happens.
After visiting your main web page, it looks like you are running IIS and your server is misconfigured to run CakePHP project. Cake needs mod_rewrite to work but the htaccess is for Apache server only.
While I'm not very sure how to do this, CakePHP documentation did tell you how to achieve this. Checkout the book here:
http://book.cakephp.org/2.0/en/installation/advanced-installation.html#url-rewrites-on-iis7-windows-hosts
Why cant you comment out the contents of test.php and add header("Location: index.php");
??
Simply delete app/webroot/test.php in your production environment.

google app engine python uploading application first time

i'm trying to upload my app engine project for the very first time and i have no clue why it is not working. the error from my terminal is:
[me][~/Desktop]$ appcfg.py update ProjectDir/
Application: tacticalagentz; version: 1
Host: appengine.google.com
Starting update of app: tacticalagentz, version: 1
Scanning files on local disk.
Error 404: --- begin server output ---
This application does not exist (app_id=u'tacticalagentz').
--- end server output ---
i'm using python 2.6.5 and ubuntu 10.04.
not sure if this is relevant, but i just created a google app engine account today. and i also just created the application today (like a couple of hours ago). this is really frustrating because i just want to upload what i have so far (as a demo). in my app.yaml this is my first line:
application: tacticalagentz
Furthermore, i checked on my admin console, and i CLEARLY see the app id right there, and it matches letter for letter with the app id in my app.yaml
could someone please enlighten me and tell me what i am doing wrong? or is it something beyond my comprehension (like indexing issue with Google that they need time to index my app id) ?
thank you very much in advance
apparently adding the "--no_cookies" parameter will work
appcfg.py update --no_cookies ProjectDir/
the way i was able to find my answer was by uploading my app from my Mac OS X (thank god i have linux mac and windows). AppEngine on Mac OS X comes with a GUI interface, and it worked for uploading. so then i found the command they used in the console, which included "--no_cookies". perhaps if you run into similar issues in the future, this is one approach to getting the answer
App Engine for Java have the same problem. The problem is about account login.
If you are using Eclipse, use Sign In button.
If u are using command-line, use "-e" option, like this:
appcfg.sh -e your#email.com update yoursite/
I had the same problem. When I changed the name of the app I used in the launcher to match the one in the app engine, It worked without any problem. The way I figured out, it was the name mismatch which caused the problem. You can see the name of your registered app in the admin console of app engine.(https://appengine.google.com/)
Here's what fixed it for me:
i had an instance of dev_appserver.py myProjDirectory/ on a different terminal.
i guess the scripts are somehow linked and aren't thread safe
An alternate option that worked for me is to just "Clear Deployment Credential" from the Control option of the GUI. When the app was deployed after this, it opened a google page to allow GAE to access the user profile and then deployment was successful.
The key bit is
This application does not exist (app_id=u'tacticalagentz').
which is telling you that appspot.com doesn't know of an application by that name. The admin console (https://appengine.google.com/) shows your applications. Check there. You might have made an inadvertent typo when you registered the app.

Resources