doudie2693 2018-08-03 23:37
浏览 59

注册后重定向到使用用户凭据登录?

I have a link /signup, if new user come and signup, I want it to redirect to /login with user credentials, and there I want to perform login operation which is running fine and redirects the user to the dashboard.

The point at which I am stuck is I unable to redirect it to login with user credentials.

To store session I am using this package: gorilla/sessions

  • 写回答

1条回答 默认 最新

  • drhg24275 2018-08-04 00:14
    关注

    Conceptually, 2 things can happen:

    1. Either you let new users to sign up and then you redirect them to a login page where they have to type their credentials, or
    2. You log people in right after they create a new account on the sign-up page.

    Sounds to me that you want to do something like 2., but are having trouble with implementation.

    I'm not sure how you do that with Gorilla Session API, but every authenticated page must have some code to look up a session cookie and determine if a given request is authenticated or not, so probably you want to create a session with UserID after a sign up and then redirect to your default page (a dashboard maybe?). Ideally, that session cookie would be encrypted.

    评论

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗