Yii 2.0.22 login trouble

hi guys im using yii 2.0.22 and im having trouble with the login system , i signup without a glitch to my user table but on login in the system refuses to login ,gives a validation error incorrect password or username . i cant figure out where the problem is. can someone help with this

Hi @shingai, welcome to the forum.

What do you mean by

And have you started with the app-basic template or with the app-advanced template?

ii mean when i signup the data is inserted into my database table user , without a problem. but when i want to login using the credential i have just signed in. the system refuses . i have started with advanced template

In an app-advanced template, usually a user has to go through these procedures:

  1. Signup using a singup form
  2. Verification by e-mail
  3. Login using a login form

Have you completed the 2nd one?

let me try the number 2 option , but it is not sending a verification email to my inbox

Iirc, the initial settings for the mailer prevents sending a real email, but it saves a file that represents the content of the sent mail in your ‘runtime’ directory. Check for it and open the link in it to complete the verification.

in my runtime directory there is only the gitignore file

That’s strange. We usually have “logs” directory there. Is “runtime” directory writable?

i have simply installed the yii2 advanced , im not entirely sure if its writable or not .

I’m not sure, but something might be wrong with your installation.
What is your current environment? And how did you install the template?

i used composer to install, the other i used manual installation. im developing with xampp,php 7.3 on windows 10.

Well, I’m now trying to install yii2-app-advanced on my local environment. I have no experience with this template so far, because I’ve been a convinced fan of yii2-app-basic. :smile:
Anyway, I’m going to try.

My development environment is apache / mariadb / php 7.2 on Windows 10.

According to the installation guide(https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide/2.0/en/start-installation), I did the following:

  1. Installing using Composer

    composer global require "fxp/composer-asset-plugin:~1.1.1"
    composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
    

    I believe that the guide is out of date, because the 1st line gave me an error and the 2nd line worked fine in spite of the 1st error.

  2. Preparing application
    2.1 run “init”
    2.2 create a db
    2.3 run “migrate”
    2.4 apache configuration
    2.5 edit hosts file

  3. Test Drive
    3.1 Access frontend … OK
    3.2 Signup … OK
    I didn’t get confirmation mail. But there is a file named 20190802-211621-3227-4231.eml in the directory of ‘@frontend/runtime/mail’.
    3.3 Login w/o email confirmation … NG
    I got “Incorrect username or password.” error.
    3.4 Email Confirmation … OK
    I opened 20190802-211621-3227-4231.eml and click on the link in it, and then I got a message ‘Your email has been confirmed!’ in my web browser.
    3.5 Login … OK

So I successfully completed the installation.
Now it’s your turn. Please try installation once again. :+1:

2 Likes

i don’t know if im doing anything wrong here but i have followed your instructions, i got the verification link
http:=//localhost/mobile/frontend/web/index.php?r=3Dsite%2Fverify-email&token=3D-=B_rSQ912_jENEMa6u6CaZbJzxrBe323_1564977323

i copied and pasted in my browser but the , the page displays 404 page not found .

is there no work around to completely come up with my own login system

You have to open the *.eml file with a mail client, e.g., Outlook, Window’s Live Mail, or Thunderbird, because it is encoded into a certain file format.

Or, if you have opened it in a text editor, you have to decode it a little.

http:=
//localhost/mobile/frontend/web/index.php?r=3Dsite%2Fverify-email&token=3D-=
B_rSQ912_jENEMa6u6CaZbJzxrBe323_1564977323

The above should be modified to

http://localhost/mobile/frontend/web/index.php?r=site%2Fverify-email&token=-
B_rSQ912_jENEMa6u6CaZbJzxrBe323_1564977323
  1. delete ‘=’ and \n at the end of every line
  2. change ‘=3D’ to ‘=’

And as the last resort, you can modify the data in the user table manually. Change status of the user from 9 to 10, which means from STATUS_INACTIVE to STATUS_ACTIVE. Please check @common\models\User.php.

1 Like

thank , you helped quite a bit there