Sử dụng panels page để làm trang Access Denied - 403

Sử dụng panels page để làm trang Access Denied - 403

What happens when a user bookmarks an access-protected page? If their session expires before they next visit the bookmark, they'll see an "Access Denied" message with no login form. How confusing for the end user! Let's change that.

>> Những Modules tốt nhất Drupal 7: Winter 2014 Edition

>> 14 Modules cần thiết cho website Drupal 7 của bạn

One good option is to use the Redirect 403 to User Login module. However, you can also accomplish similar functionality with a simple Panels page (and avoid the overhead of another module). There are two steps. First create the new Panels page to replace the standard "Access Denied" page (steps and export code below). And second, set Drupal's "Default 403 (access denied) page" setting to use the newly created Panels page.

STEP 1/2: CREATE THE PANELS PAGE

Before following the steps below, you can try starting with the export code in this gist. Visit the import page and paste in the code.

Create a new custom page.

Give it a title and a path.

Create a new variant for the un-authenticated (anonymous) 403 page. Give it a selection rule on "User: role" and select "Anonymous" as the role.

Add the "User login" widget to the variant's content section.

Create a second variant, for authenticated traffic.

This time, no selection rules are needed. Simply add a "New custom content" pane to the content section.

Give the custom content pane some text. E.g., "You are not authorized to access this page."

 

STEP 2/2: SET DRUPAL'S DEFAULT 403 (ACCESS DENIED) PAGE

Visit the Configuration » System » Site Information page.

And set the "Default 403 (access denied) page" to the URL you used above for you Panels page.

Voila! Try visiting an access-restricted page in an anonymous browser, and you'll see the login block. After logging in, you'll either see the requested page (if that user has access) or the "access denied" message (if the user doesn't have access).

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn sử dụng Drupal Go Module để Redirects

Hướng dẫn sử dụng Drupal Go Module để Redirects

The Go module (also called GoTwo) is a relatively simple Drupal module that allows you to track how many people have clicked a link.

Nhìn lại các phiên bản Versioning trong Drupal

Nhìn lại các phiên bản Versioning trong Drupal

As we head towards Drupal 8 there has been a lot of talk about versioning for contrib.

www.Ahrefs.com - Công cụ đánh giá đối thủ và quản lý backlink

www.Ahrefs.com - Công cụ quản lý backlink

Theo dõi đối thủ, quản lý backlink là một phần quan trọng trong SEO, sau đây dịch vụ seo  của chúng tôi  xin hướng dẫn các bạn sử dụng công cụ theo dõi đối thủ và quản lý backlink bằng tool Ahrefs.com

Công ty diệt chuột T&C

 

Diet con trung