DARK MODE 

Posted on Wednesday, July 13, 2022 by

Create YouTube Clone with Yii (Part 2): Signup an Account & Change URL Format

In previous part, we have create a database and run migration. We can now sign up a new account.


Signup an Account


For signup, we only need username, email and password. But unlike Laravel auth Scaffolding, Yii comes with this feature right out of the box. After a successful register, you will get a message. In Yii also, you need to verify your account to activate it in order to be able to sign in. The verification link is send to user's email.



The email that was send by Yii to user's email is located in frontend > runtime > mail. Open the .eml file. Now we need to make a few changes to the verification link inside the email.

The original link in my email is:
http://y=
utub.test/index.php?r=3Dsite%2Fverify-email&token=3DY1hTPyJU0ADfDQg6dNY_HcC=
ICYwKqNXc_1657602355

Delete the one colored in green so your final link would look like this:

http://yutub.test/index.php?r=site%2Fverify-email&token=Y1hTPyJU0ADfDQg6dNY_HcCICYwKqNXc_1657602355




Now open the link that you've modified to activate the account. You can now login!




Change URL Format

Right now, if you click on any pages, the link look something like this:

http://yutub.test/index.php?r=site%2Fsignup

We want to change it so it will look like this:

http://yutub.test/index.php/signup

To do that, go to frontend > config > main.php , scroll down to the very bottom. Uncomment the code for urlManager. Do the same thing for backend > config > main.php .




 


No comments:

Post a Comment