跳至内容
菜单
此问题已终结
4 回复
11489 查看

I would like to create a module/app to use the login authentication. I am not sure how to proceed. But registration is necessary which I have already kept ready.

The design for the login is not a matter but How to check whether the user is registered and to give separate functionalities depending upon the type of user who logins the module/website.


And also how to carry the credentials till the users logout.

形象
丢弃

Are you talking about the backend, or a front-end website?

编写者

@Michael Watchhorn, front end is not at all a problem right? I am talking about the backend.

最佳答案

I think that the solution of what you want is more simple than what you are thinking about. 

If you wanna ensure that an user is authenticated before do something you just need to do something like this into the controller of the url for that something, like the following scenario:

#making sure that the user is registered and authenticated before checkout in the shop:

from openerp import http

from openerp.http import request

from openerp.addons.website_sale.controllers.main import website_sale

class solt_website_sale(website_sale):

@http.route(['/shop/checkout'], type='http', auth="user", website=True)

def checkout(self, **post):

return super(solt_website_sale, self).checkout(**post)

For the separation of features depending of the type of users, you will need to get more familiar with Odoo security stuffs like groups, and how to use it to restrict the content that you deliver to your users


形象
丢弃
最佳答案

In .PY

fields-->

user_name=fields.Char(string="User name",required=True,help="This field has ADMIN authenticity, Provide valid user name and password")

password_login=fields.Char(string="Password",required=True,help="This field has ADMIN authenticity, Provide valid user name and password")

check_valid=fields.Char(compute="check_user_password",string=" Login",help="If USER NAME and PASSWORD are Matched, Then it will show you LOGIN BUTTON")

@api.one

@api.depends('user_name','password_login')

def check_user_password(self):

    if self.user_name=='vicky' and self.password_login=='vicky':

    self.check_valid=True 

AND in XML

<field name="user_name" style="width:60%%;height:5%%;font-size:15px" placeholder=" USER NAME"/>

<field name="password_login" style="width:60%%;height:5%%;font-size:15px" placeholder=" PASSWORD" password="1"/>


<field name="check_valid" />

<button name="%(customer_action_window)d" type="action"

class="oe_highlight oe_stat_info oe_right o_wow" style="background-color:#32CD32"

icon="fa-sign-in" attrs="{'invisible':[('check_valid','=',False)]}" />

 You may fetch records from db and check it for login... whenever the condition is "True", it automaticlly Shows the Button to login... Hope this will give some Idea to u...

形象
丢弃
编写者 最佳答案

Axel Mendoza thanks for the reply. This is also required for me. But I am asking for the basic authentication. i.e., the login process itself. You are saying about the process after the login for holding up the authentication.

形象
丢弃

The login process itself is already handled by Odoo out of the box.

编写者

How to make a custom registration form to add users to the database then?

编写者

@Annadurai Thank you for your reply. I have made this design already with a different scenario. But I need to check the database for the user name and the password which is in a different table. But inside the same project.

最佳答案

You can use these apps (search apps in odoo apps by names provided below) to change the whole login page style.

Moreover, these apps provide the ability to define your own favicon and logo as you wish.

Apps Name:

Minimalist Login Form

Creative Login Form

Advanced Login Form


形象
丢弃
相关帖文 回复 查看 活动
1
9月 24
1318
0
4月 24
1826
4
11月 23
5865
0
10月 23
1670
0
12月 22
2552