-1

i want a authentication ,many people to login with a particular username and password at the same time and it is not good , where User A logs in with username = sammy and password = sammy123, User B cannot login with the same username = sammy and in one session password = sammy123 while I am still logged into an application...,i am using ruby 1.8.7 and devise gem for authentication, rails 2

2 Answers2

1

1.add a column(flag) in table mdl_user store a 'false' value when user create new account .

2.Make a function which accept three value table name,flag field and username(which user enter) .this function return the value of flag field (true or false) .This function call if the user exist in database.

2.1 if 'false' returned then allow to login user and insert value into flag field 'true'. 2.2 if 'true'retuned then do not allow to login and print the message below the username and password field "This user already logged".Do not insert any value in database.

2.3 Now when sign out user then insert into flag field value 'flase'.

3.User allow to login only when flag field value 'false'.

Sanju B Myh
  • 271
  • 1
  • 15
0

better use this link http://www.gotealeaf.com/blog/how-to-use-devise-in-rails-for-authentication and check the version of devise gem you had used in your application.

Hemanth M C
  • 436
  • 1
  • 4
  • 18