Jump to content

[Rubyonrails] Manage account


fooheyy

Recommended Posts

Hi,

I'm looking for manage mangos accounts with Rails 3.

I'm using Authlogic (https://github.com/binarylogic/authlogic)

So, a rapidly working way, but certainly not the best,

is adding 'user_id' column to realmd > account, creating the realmd_account model, establish associations between user and realmd_account (has_one :realmd_account, belongs_to :user).

:001 > @user = User.find(1)
=> #<User id: 1, login: "foohey", email: "[email protected]", crypted_password: "", password_salt: "", persistence_token: "", login_count: 39, failed_login_count: 0, last_request_at: "2011-03-05 13:51:35", current_login_at: "2011-03-05 12:51:09", last_login_at: "2011-03-05 12:51:02", current_login_ip: "127.0.0.1", last_login_ip: "127.0.0.1", created_at: "2011-03-05 12:17:41", updated_at: "2011-03-05 13:51:35", realmd_account_id: 5> 

:002 > @user.realmd_account
=> #<RealmdAccount id: 5, user_id: 1, username: "FOOHEY", sha_pass_hash: "", gmlevel: 2, sessionkey: "", v: "", s: "", email: nil, joindate: "2011-02-12 16:33:19", last_ip: "", failed_logins: 0, locked: 0, last_login: "2011-03-02 10:52:38", active_realm_id: 0, expansion: 1, mutetime: 0, locale: 2> 

:003 > @user.realmd_account.email
=> nil 

:004 > @user.realmd_account.email = "[email protected]"
=> "[email protected]" 

:005 > @user.realmd_account.save
=> true 

:006 > @user.realmd_account
=> #<RealmdAccount id: 5, user_id: 1, username: "FOOHEY", sha_pass_hash: "", gmlevel: 2, sessionkey: "", v: "", s: "", email: "[email protected]", joindate: "2011-02-12 16:33:19", last_ip: "", failed_logins: 0, locked: 0, last_login: "2011-03-02 10:52:38", active_realm_id: 0, expansion: 1, mutetime: 0, locale: 2>

do you think this is a secure solution ?

Link to comment
Share on other sites

  • 7 months later...

Its definetly bad solution to even use rails's built-in acriverecord. Curently it does not allow enought flexibility in working with databases, that a good mangos server website requires. One solution is to use DataMapper as ORM.

On topic: I prefer to keep mangos tables clean, so I'd better add an account_id to ser model and set User benong to Account.

Btw, why authlogic here? It sure will not be easy to configure it properly.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use