小编erk*_*mir的帖子

身份密码重置令牌无效

我正在编写MVC 5并使用Identity 2.0.

现在我想重置密码.但我总是收到重置密码令牌的"无效令牌"错误.

    public class AccountController : Controller
{
    public UserManager<ApplicationUser> UserManager { get; private set; }

    public AccountController()
        : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())))
    {
    }
Run Code Online (Sandbox Code Playgroud)

我设置了DataProtectorTokenProvider,

        public AccountController(UserManager<ApplicationUser> userManager)
    {   
        //usermanager config
        userManager.PasswordValidator = new PasswordValidator { RequiredLength = 5 };  
        userManager.EmailService = new IddaaWebSite.Controllers.MemberShip.MemberShipComponents.EmailService(); 

        var provider = new Microsoft.Owin.Security.DataProtection.DpapiDataProtectionProvider();
        userManager.UserTokenProvider = new Microsoft.AspNet.Identity.Owin.DataProtectorTokenProvider<ApplicationUser>(provider.Create("UserToken"))
                                                    as IUserTokenProvider<ApplicationUser, string>;




        UserManager = userManager;

    }
Run Code Online (Sandbox Code Playgroud)

我在发送邮件之前生成密码重置

 [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> ManagePassword(ManageUserViewModel model)
    {
        if (Request.Form["email"] != null)
        {
          var email = …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-identity

28
推荐指数
3
解决办法
1万
查看次数

上传amazon s3后获取文件网址

我需要在将文件上传到amazons3服务器后获取文件URL.这是我的上传代码.如何返回amazons3路径?

public static bool UploadToS3(string bucketName, string bucketFilePath, Byte[] localPath)
    {
        var client = Amazon.AWSClientFactory.CreateAmazonS3Client(Config.EmailServer.AwsAccessKey, Config.EmailServer.AwsSecretKey, Amazon.RegionEndpoint.EUWest1);

        PutObjectRequest request = new PutObjectRequest()
        {
            BucketName = bucketName,
            Key = bucketFilePath,
            InputStream = new MemoryStream(localPath),
            AutoCloseStream = true,
            CannedACL = S3CannedACL.PublicRead,
            StorageClass = S3StorageClass.ReducedRedundancy                
        };

        PutObjectResponse response = client.PutObject(request);
        return true;
    }
Run Code Online (Sandbox Code Playgroud)

.net c# amazon amazon-s3

12
推荐指数
2
解决办法
9050
查看次数

Sinatra并不是以twitter gem开头的

当我尝试启动sinatra时,我遇到了以下错误

/var/lib/gems/1.9.1/gems/sinatra-1.4.4/lib/sinatra/base.rb:1488:in'for start_server': undefined methodHTTP:Module(NoMethodError)

require 'sinatra/base'
require_relative "twt.rb"

class SinatraApp < Sinatra::Base
    set :static, true
    set :public_folder, File.dirname(__FILE__) + '/static'

    get '/getuserinfo' do
        @user = twit.getuserinfo
        erb :userInfo
    end
end

SinatraApp.run!
Run Code Online (Sandbox Code Playgroud)

在"twt.rb"我需要推特(5.7.1)

require 'twitter'

class Twit
    attr_accessor :client

    def initialize(consumer_key,consumer_secret,access_token,access_token_secret)           
        @client = Twitter::REST::Client.new do |config|
          config.consumer_key        = consumer_key
          config.consumer_secret     = consumer_secret
          config.access_token        = access_token
          config.access_token_secret = access_token_secret
        end
    end

    def getUserInfo
        return user = {     
            "name"=> client.current_user.name,
            "id" => client.current_user.id
        }
    end

    def showAllFriends
         client.friends.each { |item| puts …
Run Code Online (Sandbox Code Playgroud)

ruby twitter sinatra

5
推荐指数
2
解决办法
1134
查看次数

Firebase Crashlytics:设置请求失败 - 从结构迁移后

从 Fabric 迁移到 crashlytics 后,Firebase 控制台上不再显示崩溃报告。我按照升级文档进行迁移。

我尝试强制崩溃进行测试并使用 登录adb logcat -s FirebaseCrashlytics,我注意到读取设置时出现错误。 FirebaseCrashlytics:设置请求失败。

09-29 16:09:56.619   683   721 D FirebaseCrashlytics: Requesting settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/1:657730209335:android:0f0486036fa5647e/settings
09-29 16:09:56.619   683   721 D FirebaseCrashlytics: Settings query params were: {instance=23c94567f3a0450c2c4276ef9c4f083d3e073ab9, build_version=714012888, display_version=7.14.0.128, source=1}
09-29 16:09:56.641   683   721 E FirebaseCrashlytics: Settings request failed.
Run Code Online (Sandbox Code Playgroud)

这是我的设置。

{"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"5e00a1546bfe67fb08000062","bundle_id":"com.univera.android"}}
Run Code Online (Sandbox Code Playgroud)

firebase_crashlytics_enabled”设置中的状态为 false

在控制台上启用了 Crashlytics。

我正在使用版本 17.2.1 implementation 'com.google.firebase:firebase-crashlytics:17.2.1'并且启用了 CrashlyticsCollectionFirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);

为什么我的设置中 firebase_crashlytics_enabled”状态为 false 以及设置请求有什么问题。

从 Fabric 迁移后,有人在 Firebase 控制台上看到报告吗?

crash android firebase crashlytics-android google-fabric

5
推荐指数
1
解决办法
6431
查看次数

NHibernate Sqldatetime必须在1/1/1753和12/31/9999之间

我在我的MVC项目中使用NHibernate.我的问题是,当我试图更新一个对象后,我得到跟随错误.

SqlDateTime溢出.必须在1/1/1753 12:00:00 AM和12/31/9999 11:59:59 PM之间.

在调试模式下,我看到date属性不为null.我在映射上设置了Datetime nullable.但我仍然得到sqldatetime错误.

public class EntityBaseMap<T> : ClassMap<T> where T : EntityBase
{
    public EntityBaseMap()
    {
        Id(x => x.Id).GeneratedBy.Identity();
        Map(x => x.IsDeleted).Not.Nullable();
        Map(x => x.CreatedAt).Nullable();
        Map(x => x.UpdatedAt).Nullable();
        Map(x => x.Random).Formula("NEWID()");

        References(x => x.Status).Column("StatusId");

        Where("IsDeleted=0");
    }
}
Run Code Online (Sandbox Code Playgroud)

保存时,日期时间属性不为空.

public int SaveOrUpdatePage(PageDto PageDto)
{
    var page = PageDto.Id > 0 ? ById<Page>(PageDto.Id) : new Page();
    var status = PageDto.Status.Id > 0 ? LookupById<Status>(PageDto.Status.Id) : null;
    var type = PageDto.Type.Id > 0 ? LookupById<PageType>(PageDto.Type.Id) : null;
    //var …
Run Code Online (Sandbox Code Playgroud)

c# sql-server nhibernate

4
推荐指数
1
解决办法
2005
查看次数

使用gunicorn部署Django没有名为ImportError的模块:没有名为validation的模块

我试图使用nginx,gunicorn和virtualenv来部署我的Django项目.但是在运行此评论时我得到了以下错误

sudo gunicorn_django --bind test.com:8001
Run Code Online (Sandbox Code Playgroud)

记录:

Traceback (most recent call last):
  File "/opt/postjust/lib/python2.7/site-packages/gunicorn/arbiter.py", line 503, in spawn_worker
    worker.init_process()
  File "/opt/postjust/lib/python2.7/site-packages/gunicorn/workers/base.py", line 116, in init_process
    self.wsgi = self.app.wsgi()
  File "/opt/postjust/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/opt/postjust/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 105, in load
    mod = util.import_module("gunicorn.app.django_wsgi")
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/postjust/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 21, in <module>
    from django.core.management.validation import get_validation_errors
ImportError: No module named validation
[2015-02-23 00:58:17 +0200] [10584] [INFO] Worker exiting (pid: 10584)
[2015-02-23 00:58:17 +0200] [10581] …
Run Code Online (Sandbox Code Playgroud)

python django nginx python-2.7 gunicorn

3
推荐指数
1
解决办法
2万
查看次数

heroku上的Flask项目返回500内部服务器错误

我有一个基本的烧瓶项目,我将它部署到heroku.页面返回500内部服务器错误.我没有使用数据库.这是我的日志:

2015-01-10T23:40:03.161880+00:00 heroku[web.1]: Starting process with command `gunicorn print:app --log-file=-`
2015-01-10T23:40:03.827603+00:00 app[web.1]: [2015-01-10 23:40:03 +0000] [2] [INFO] Using worker: sync
2015-01-10T23:40:03.827516+00:00 app[web.1]: [2015-01-10 23:40:03 +0000] [2] [INFO] Listening at: http://0.0.0.0:5144 (2)
2015-01-10T23:40:03.835308+00:00 app[web.1]: [2015-01-10 23:40:03 +0000] [8] [INFO] Booting worker with pid: 8
2015-01-10T23:40:03.887218+00:00 app[web.1]: [2015-01-10 23:40:03 +0000] [9] [INFO] Booting worker with pid: 9
2015-01-10T23:40:03.826883+00:00 app[web.1]: [2015-01-10 23:40:03 +0000] [2] [INFO] Starting gunicorn 19.1.1
2015-01-10T23:40:04.268774+00:00 heroku[web.1]: State changed from starting to up
2015-01-10T23:41:19.847544+00:00 heroku[router]: at=info method=GET path="/" host=topstreaks.herokuapp.com request_id=a2450ab9-3183-473f-aa0e-8e970b266b28 …
Run Code Online (Sandbox Code Playgroud)

python heroku flask

2
推荐指数
1
解决办法
3728
查看次数