cookies

Flask 快速上手文档4

两盒软妹~` 提交于 2020-01-17 02:36:05
Cookies 要访问 cookies ,可以使用 cookies 属性。可以使用响应 对象 的 set_cookie 方法来设置 cookies 。请求对象的 cookies 属性是一个包含了客户端传输的所有 cookies 的字典。在 Flask 中,如果使用 会话 ,那么就不要直接使用 cookies ,因为 会话 比较安全一些。 读取 cookies: from flask import request @app.route('/') def index(): username = request.cookies.get('username') # use cookies.get(key) instead of cookies[key] to not get a # KeyError if the cookie is missing. 储存 cookies: from flask import make_response @app.route('/') def index(): resp = make_response(render_template(...)) resp.set_cookie('username', 'the username') return resp 注意, cookies 设置在响应对象上。通常只是从视图函数返回字符串, Flask 会把它们

Angular 6 auth using cookies

余生颓废 提交于 2020-01-16 20:33:49
问题 Any idea on how to implement cookie auth in Angular 6? I have tried using AuthGuard but I'm not able to check if the user is authenticated or not because the cookie is HttpOnly so I can't access its content. I need this to protect some routes. Thanks!!! 回答1: with JWT you should save the token, you must kepp the key in the cookie. 来源: https://stackoverflow.com/questions/52874219/angular-6-auth-using-cookies

How to delete Safari cookies from OS 10.7.2 terminal? [closed]

吃可爱长大的小学妹 提交于 2020-01-16 20:09:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . I would like to delete all Safari cookies from terminal on Mac OS 10.7.2. I tried to delete ~/Library/Cookie/Cookies.binarycookies (this is the only file in ~/Library/Cookie ), but it didn't help. Please advise. 回答1: The missing part was to kill the cookied process: killall cookied 来源: https://stackoverflow.com

ASP.NET_SessionId cookie not sent in request from IE browser for intranet site

微笑、不失礼 提交于 2020-01-16 19:46:29
问题 When accessing an ASP.NET MVC application hosted on intranet from IE, the ASP.NET_SessionId is not sent in the request. This occurs on specific test serves. On our development serves hosting the same application, i see that the ASP.NET_SessionId cookie is sent. Below is the difference i see form the network trace. On the server that not working. <entry> <pageref>1</pageref> <startedDateTime>2018-05-17T12:01:50.566+00:00</startedDateTime> <time>188</time> <request> <method>GET</method> <url

TideSDK How to save a cookie's information to be accessed in different file?

别来无恙 提交于 2020-01-16 18:42:10
问题 I am trying to use TideSDK's Ti.Network to set the name and value of my cookie. But how do I get this cookie's value from my other pages? var httpcli; httpcli = Ti.Network.createHTTPCookie(); httpcli.setName(cname); //cname is my cookie name httpcli.setValue(cvalue); //cvalue is the value that I am going to give my cookie alert("COOKIE value is: "+httpcli.getValue()); How would I retrieve this cookie value from my next page? Thank you in advance! 回答1: ok, there are a lot of ways to create

printing out personal info stored as cookie and session php

拥有回忆 提交于 2020-01-16 18:34:49
问题 I am trying to make the webpage alert users if the user hasn't filled out personal information or shopping order... It is not doing what I would like it to be doing.. i think it is probably because I have used php for one and javascript for another one.. Personal Info.php <?php if(isset($_COOKIE['name'])) { $name = $_COOKIE['name']; $email = $_COOKIE['email']; $address = $_COOKIE['address']; $phone = $_COOKIE['phone']; $credit = $_COOKIE['credit']; $expire = $_COOKIE['expire']; $cvs = $

req.session.destroy and passport logout aren't destroying cookie on client side

夙愿已清 提交于 2020-01-16 16:57:11
问题 I'm trying to destroy the cookie on the client side but can't seem to figure out how to. I've tried the few ways that passport and some answers on SO provided but I'm at a loss as to how to clear the actual cookie. My code so far is: app.get('/logout', function (req, res){ sessionStore.destroy(req.sessionID, (err) =>{ if(err)console.log(err); req.logout(); req.session.destroy(function (err) { if(err) console.log(err); res.status(200).json({message : 'User Logged Out'}); }); }); }); I have

jQuery cookie: How can I save the color selection of the user for the next visit?

北战南征 提交于 2020-01-16 16:47:13
问题 I'm working on a jQuery predefined color picker. I'd like to save the color selection when the user click on one of the colors of my color picker: http://prntscr.com/7rnafa . To interact with cookies, I am using the jQuery plugin at https://github.com/carhartl/jquery-cookie . jQuery code: var color_elements_background = ".nodeList .categoryStrip, .breadcrumb"; var color_elements_text = "a:link, a:visited"; $(".colorPicker span").on("click", function() { var customColor = $(this).attr("custom

driver.Manage().Cookies.DeleteAllCookies(); not working for Edge Browser Windows 10 selenium c#

六眼飞鱼酱① 提交于 2020-01-16 14:00:34
问题 My code: driver = new EdgeDriver("D://Projects//Selenium Jars//LatestSelenium//"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); //driver.Manage().Window.Maximize(); driver.Manage().Cookies.DeleteAllCookies(); driver.Navigate().Refresh(); System.Threading.Thread.Sleep(5000); This is working in Chrome and Firefox but not in Edge 回答1: Try this below code and let me know driver.manage().deleteAllCookies(); 来源: https://stackoverflow.com/questions/48062261/driver-manage

Why is Request.Cookies null?

妖精的绣舞 提交于 2020-01-16 12:03:50
问题 This is a follow-up on another thread I have running which is Reading cookie in c# . However, the answers in that post seem to beat around the bush so I want to simplify my question here. I think that answering this, I'll be able to solve that problem. Stuck almost two days now trying to read a cookie so any help is appreciated. What could cause a NullReferenceException at this line: HttpCookie aCookie = Request.Cookies["UserSettings"]; I am sure a cookie called "UserSettings" is there, as I