简体   繁体   English

具有2种用户类型的Ruby On Rails用户登录

[英]Ruby On Rails User Login With 2 User Types

I am learning RoR for a week now and I am trying to make a login system with 2 types of users, Doctor user and Patient user. 我现在已经学习了一周的RoR,并且正在尝试使用两种类型的用户(医生用户和患者用户)创建登录系统。 You will be able to register as a doctor only if you have the secret password (eg 123) but you can create an ordinary patient registration using your personal details such as (mail,first name , last name etc..) . 仅当您具有秘密密码(例如123)时,您才可以注册为医生,但是您可以使用您的个人详细信息(例如,邮件,名字,姓氏等)创建普通的患者注册。 Each user will be redirected to his own page , doctor users has different Interface from the Patient users. 每个用户将被重定向到自己的页面,医生用户与患者用户具有不同的界面。

I do not want to use the plugins for authentication yet because i will be confused 我不想使用插件进行身份验证,因为我会感到困惑

My questions is how can i create this situation I described? 我的问题是我该如何描述这种情况? Can somebody give me a simple approach on my problem? 有人可以解决我的问题吗?

Thanks for any insight you may have. 感谢您的任何见解。

最简单的方法是在控制器的create方法中检查params[:secret_password] == "foo" ,然后创建适当的用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM