Yii Framework Forum: Yii skeleton app - Yii Framework Forum

Jump to content

  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • This topic is locked

Yii skeleton app Rate Topic: -----

#1 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 11 February 2009 - 08:41 PM

This is a skeleton application that it a good reference for beginners.

Disclaimer
I am not advertising these methods of programing as "best practices" for Yii.

Download
http://code.google.c...i-skeleton-app/

Live demo (old version)

http://yii.cubedwater.com

You may login with admin/admin

You may use this code in any way you wish.  You can use it as your own skeleton app, or use it as a reference, or for ideas, or to get a better under standing for Yii, or some part of it.  Whatever you want.

If anyone has any comments on it that would be great.
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 11 February 2009 - 08:59 PM

Very nice indeed!

I noticed that GroupController::actionList() is using the old code. Perhaps it should be updated to be consistent with that in UserController.

Today I checked in a minor enhancement to access control filter. You can use specify an exp​ression in the rule. Perhaps that may eliminate the need for you to extend the existing access control filter?
0

#3 User is offline   meanpenguin 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 08-November 08

Posted 14 February 2009 - 01:24 PM

Awesome!

What do you think about getting this code under revision control and allowing people to update it as a reference application?

That way, it can be updated for best practices and additional functionality.

Maybe a SF project?

Thanks
0

#4 User is offline   creator 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-February 09

Posted 14 February 2009 - 01:33 PM

very useful - I especially like the included debug features.

One small point, when creating a new user and trying to verify the email address I seeing 'Page Not Found    The requested controller "users" does not exist'.

This is an example verify link;

http://localhost/yii...2x6vakny34juzn3

Is there a typo in the link or something I'm doing wrong?
I have attempted to see what's going on myself, but am very new to Yii!

thanks in advance.
0

#5 User is offline   Bios Element 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-February 09
  • Location:Ohio, USA

Posted 14 February 2009 - 01:37 PM

Quote

very useful - I especially like the included debug features.



One small point, when creating a new user and trying to verify the email address I seeing 'Page Not Found    The requested controller "users" does not exist'.



This is an example verify link;



http://localhost/yii...2x6vakny34juzn3



Is there a typo in the link or something I'm doing wrong?

I have attempted to see what's going on myself, but am very new to Yii!



thanks in advance.


Try replacing users with "user". I haven't looked at the code yet but that's probably the bug there. Or there may not be a view for the page.
0

#6 User is offline   creator 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-February 09

Posted 14 February 2009 - 01:52 PM

Yes I did try this, which results in the following;

'Page Not Found    The system is unable to find the requested action "verify".'
0

#7 User is offline   Bios Element 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-February 09
  • Location:Ohio, USA

Posted 14 February 2009 - 01:53 PM

Quote

Yes I did try this, which results in the following;



'Page Not Found    The system is unable to find the requested action "verify".'


Yeah, Doesn't look like the verify action is there. >.>
0

#8 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 14 February 2009 - 04:00 PM

@qiang
Thanks :)

I just updated the groups controller to not use the "old" code.  I'll try to upload today...

And yes, the enhancement you made to the access control feature destroys the need for me to extend it, I still like my extension of it better as it requires less typing when setting access controls, so I think i'll leave it.  You can see I commented in documentation as to how it works in the AccessControlFilter.php .  I also put in some instructions to un-extend it (just now).

Quote

One small point, when creating a new user and trying to verify the email address I seeing 'Page Not Found    The requested controller "users" does not exist'.


Oops!  Sorry, I totally forgot to implant that part of the application.  I'll try to get that in the next update.

@meanpenguin
This may sound absurd but I'm still learning my revision control.  I have mixed feeling about putting it under SVN because I know different people have different needs for a skeleton app (for instance I extended the access control filter and I think a lot of people would not like that for themselves personally).

In any case, if anyone would like to fork the project that's fine.

I'll try to get an update in today
1

#9 User is offline   Bios Element 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-February 09
  • Location:Ohio, USA

Posted 14 February 2009 - 04:59 PM

Quote

@meanpenguin

This may sound absurd but I'm still learning my revision control.  I have mixed feeling about putting it under SVN because I know different people have different needs for a skeleton app (for instance I extended the access control filter and I think a lot of people would not like that for themselves personally).



In any case, if anyone would like to fork the project that's fine.



I'll try to get an update in today

Well We could always setup a few branches of it. If you like I can setup a google code project and If you want you can just E-mail me the updates and I'll manage Uploading them and such for you. Might be a bit easier if you've never done SVN before.

Of course people have different needs but a 'clean'-ish starting point is always the best for people to work off.
0

#10 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 14 February 2009 - 06:04 PM

I need to learn it anyways so I think i'll give it a try myself when I get time.  I just uploaded an update but now I got to get some other work done off the computer.

Anyways, the update includes:
* Replaced "old" code in group controller
* (btw, the group create view now has some JS that might be interesting to some)
* Added a few more comments/documentation here and there
* Added user verification action
* Added User::get/setActivated() and User::getActivationCode()
* Depreciated use of User::unconfirmEmail() in favor of $user->activated = true/false;
* This list is from memory and may not include everything
0

#11 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 426
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 14 February 2009 - 07:43 PM

Quote

If you like I can setup a google code project and If you want you can just E-mail me the updates and I'll manage Uploading them and such for you. Might be a bit easier if you've never done SVN before.



Of course people have different needs but a 'clean'-ish starting point is always the best for people to work off.

Please do it, for I found following message when I clicked the tab of `Users`.

Quote

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.group_id' in 'on clause'

0

#12 User is offline   creator 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-February 09

Posted 14 February 2009 - 07:47 PM

thanks for fixing this so promptly.

the user verify link works!

however, when i try and log in with the newly created user/pass I'm told that the password is incorrect.
The password has been stored in the DB as a md5 hash, and (i think) the user input password is being md5() hashed before comparing them.

I tried changing the password on the Admin account, and logging in with the new password - and this works.

any ideas where the problem might be occurring?
0

#13 User is offline   Bios Element 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-February 09
  • Location:Ohio, USA

Posted 14 February 2009 - 08:34 PM

Quote

Quote

If you like I can setup a google code project and If you want you can just E-mail me the updates and I'll manage Uploading them and such for you. Might be a bit easier if you've never done SVN before.



Of course people have different needs but a 'clean'-ish starting point is always the best for people to work off.


Please do it, for I found following message when I clicked the tab of `Users`.



Quote

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.group_id' in 'on clause'


I'll only do so with Jonah permission which I don't have yet. But as soon as he consents I'll be happy to set it up and get a bug system going. :)
0

#14 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 14 February 2009 - 09:31 PM

@mocapapa
I don't see any obvious reasons that you are getting that area.  Can you confirm that your user table actually does have the group_id column? It should.  Did it spit out any other debug info that might help me?

@creator

fixed and uploaded.  The problem is that when the user verified his account, it rehashed his password.  So now it makes sure the password actually changed before hashing it, unless it is a new user in which case it hashes it anyways

btw, do you also get the error that mocapapa gets?

@Bios Element

You have permission to do whatever you want with it, but I wont send the the patches directly to you (but you could theoretically still do it).  I will try to get a svn up myself pretty soon (hopefully).




0

#15 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 426
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 14 February 2009 - 10:47 PM

Hi Jonah,

Quote

@mocapapa

I don't see any obvious reasons that you are getting that area.  Can you confirm that your user table actually does have the group_id column? It should.  Did it spit out any other debug info that might help me?


I found that there already was a table named 'user' and it conflicts the new one.

I changed the database and created the new tables. Though I have to rename the table 'user' to 'User' and 'group' to 'Group', it begins to work. Sorry for bothering you. :)
0

#16 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 426
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 14 February 2009 - 11:03 PM

BTW, is this expected behavior when I lost my password and tried to recover by entering my e-mail address?

Quote

.: Dumping email



The email extension is in debug mode, which means that the email was not actually sent but is dumped below instead

Email

To: mocapapa@pugpug.org

Subject: User Recovery



You have requested us to recover your login credentials at My Web Application (http://yii.localhost/demos/yiiSkeleton).



Your Username: mocapapa

Unfortunetally we are not able to recover your password as it is encrypted

Additional headers



Content-Type: text/html; charset=utf-8

MIME-Version: 1.0


I know there is no way to recover encrypted password though...

0

#17 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 14 February 2009 - 11:09 PM

For me it works with the tables as under-case... And I'm not sure why Yii is making the first letter capital, within the app all the tables are written in lower-case.

Could it be a mysql setting that turns on case-sensitivity?

Also, I can't think of any way for a user to be able to recover his password, because it is encrypted in the database.  Not sure what I'm going to do about that, but i'll probably remove that silly little message and instead have a password reset option for those who correctly know their username and email (and then the new password will be sent to their email)

BTW thanks for reminding me
0

#18 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 14 February 2009 - 11:55 PM

Update:

* Added the ability for a user to reset his password
* Removed auto-password encryption in beforeSave() (in favor of just directly calling a new method encryptPassword() ) - Note: this is not something you need to know unless you were messing around with the code I wrote
0

#19 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 426
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 14 February 2009 - 11:58 PM

Quote

For me it works with the tables as under-case... And I'm not sure why Yii is making the first letter capital, within the app all the tables are written in lower-case.



Could it be a mysql setting that turns on case-sensitivity?

I am not sure about that. Would some one please describe this case sensitivity?

Quote

Also, I can't think of any way for a user to be able to recover his password, because it is encrypted in the database.  Not sure what I'm going to do about that, but i'll probably remove that silly little message and instead have a password reset option for those who correctly know their username and email (and then the new password will be sent to their email)

I have the same opinion. The system should generate a random password which is sent to end users and should be replaced by the one supplied by end users.

Quote

BTW thanks for reminding me

Thank you for this skeleton application as a common base for every Yii application. As I would like to extend this, I hope to have an open SVN system such as google code.
0

#20 User is offline   Bios Element 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-February 09
  • Location:Ohio, USA

Posted 15 February 2009 - 01:20 AM

SVN online. http://code.google.com/p/yii-skeleton/

Anyone who would like access, PM me your Google account and I'll set you up. :)
0

Share this topic:


  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users