LoginSignup
1
1

More than 5 years have passed since last update.

Meteorのあんちょこ꒰。・ω・`;꒱ アカウント管理

Last updated at Posted at 2016-08-22

概要

パッケージインストール

meteor add accounts-ui
meteor add accounts-password

ソースコード

  • ユーザ名でログインする。
imports/accounts-config.js
import { Accounts } from 'meteor/accounts-base';

Accounts.ui.config({
  passwordSignupFields: 'USERNAME_ONLY',
});
client/main.js
import '../imports/startup/accounts-config.js';
client/main.html
  {{> loginButtons}}

Database確認

console
meteor:PRIMARY> db.users.find()
{ 
  "_id" : "AKXiS8Wp88d44ZJS2", 
  "createdAt" : ISODate("2016-08-22T17:53:58.182Z"), 
  "services" : { 
    "password" : { "bcrypt" : "$2a$10$TItTHVAdvSzkCya6H/B3IeavZQm607OB.6NFXeyrmLYFh.FvUsVdu" }, 
    "resume" : { 
      "loginTokens" : [ { "when" : ISODate("2016-08-22T17:53:58.193Z"), "hashedToken" : "8YMw5S6L47DA0WqGF9fSEzSiVB+ub5qDfrC0gvESCiA=" } ] 
    } 
  }, 
  "username" : "hogehoge" 
}
meteor:PRIMARY> 


BCrypt(Blowfish暗号)関連のエラー

  • アカウント認証にBCrypt(Blowfish暗号)を使用時に表示されるエラー - pure-Javascriptで組み込んでいると、ネイティブより3倍遅いため、プロジェクトルートにてbcryptをインストールする様にという指示あり。
console
$ meteor
    :
W20160830-11:50:40.866(-4)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20160830-11:50:40.868(-4)? (STDERR) While this implementation will work correctly, it is known to be
W20160830-11:50:40.868(-4)? (STDERR) approximately three times slower than the native implementation.
W20160830-11:50:40.868(-4)? (STDERR) In order to use the native implementation instead, run
W20160830-11:50:40.869(-4)? (STDERR)          
W20160830-11:50:40.869(-4)? (STDERR)   meteor npm install --save bcrypt
W20160830-11:50:40.869(-4)? (STDERR)          
W20160830-11:50:40.870(-4)? (STDERR) in the root directory of your application.

# 
$ meteor npm install --save bcrypt

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1