ionicthemes / ionic-wordpress-integration

Ionic Wordpress starter app 😎. Learn how to communicate your ionic app with Wordpress REST API with this starter and detailed tutorial.
https://ionicthemes.com/tutorials/about/ionic-wordpress-integration
265 stars 126 forks source link

Problem with register #9

Closed magnogcs closed 6 years ago

magnogcs commented 6 years ago

Hi! I'm having a problem when I try to sign up. The login page is working when I login with the default credentials from my local WordPress (user root pass root), but the register isn't working, all I see is JSON: [jwt_auth] empty_username. And when I send directly values it shows me the mistake as if I was trying to login (invalid username), could this be a problem with my jwt-auth settings?

my wp .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:Authorization} ^(.*) SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule>

wp-config.php: [...] define('JWT_AUTH_CORS_ENABLE', true); define('JWT_AUTH_SECRET_KEY', 'your-top-secrect-key');

nabilzidane commented 6 years ago

Hi, @magnogcs No it's not. you need to know that only admin can create new users, so you have to add some details : Go to PROJECT_FILES/src/pages/register/register.ts and change the following details :

32    onSubmit(values){
33      var username: '**aa**'; // this should be an administrator Username
34      var password: '**aa**'; // this should be an administrator Password

aa values must be your admin identification.

The App will login as an admin and post a new user with the informations provided in the register form.

djabif commented 6 years ago

That's correct. Thanks @nabilzidane for the clarification.