Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #40 from LiskHQ/save-passphrase-for-development
Browse files Browse the repository at this point in the history
Setup autologin from a cookie for development purposes
  • Loading branch information
karmacoma authored Mar 6, 2017
2 parents 0f81de0 + e6ed9d4 commit 99c9c97
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export default angular.module('app', [
'ngMessages',
'ngMaterial',
'ngAnimate',
'ngCookies',
'md.data.table',
])
11 changes: 7 additions & 4 deletions src/app/components/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ app.component('login', {
onLogin: '&',
},
controller: class login {
constructor ($scope, $rootScope, $timeout, $document, $mdDialog, $mdMedia) {
constructor ($scope, $rootScope, $timeout, $document, $mdDialog, $mdMedia, $cookies) {
this.$scope = $scope
this.$rootScope = $rootScope
this.$timeout = $timeout
this.$document = $document
this.$mdDialog = $mdDialog
this.$mdMedia = $mdMedia
this.$cookies = $cookies

this.$scope.$watch('$ctrl.input_passphrase', this.isValid.bind(this))
// this.$timeout(this.devTestAccount.bind(this), 200)
this.$timeout(this.devTestAccount.bind(this), 200)

this.$scope.$watch(() => {
return this.$mdMedia('xs') || this.$mdMedia('sm');
Expand Down Expand Up @@ -175,8 +176,10 @@ app.component('login', {
}

devTestAccount () {
this.input_passphrase = 'stay undo beyond powder sand laptop grow gloom apology hamster primary arrive'
this.$timeout(this.go.bind(this), 100)
this.input_passphrase = this.$cookies.get('passphrase');
if (this.input_passphrase) {
this.$timeout(this.go.bind(this), 100)
}
}

fix (v) {
Expand Down
1 change: 1 addition & 0 deletions src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'jquery'

import 'angular'
import 'angular-animate'
import 'angular-cookies'
import 'angular-aria'
import 'angular-messages'
import 'angular-material'
Expand Down
6 changes: 4 additions & 2 deletions src/app/services/peers/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import './peer'

const UPDATE_INTERVAL_CHECK = 10000

app.factory('$peers', ($peer, $timeout) => {
app.factory('$peers', ($peer, $timeout, $cookies) => {
class $peers {
constructor () {
this.stack = {
Expand Down Expand Up @@ -38,7 +38,9 @@ app.factory('$peers', ($peer, $timeout) => {

setActive () {
this.active = _.chain([])
.concat(this.stack.official, this.stack.public)
.concat($cookies.get('peerStack') == 'testnet' ?
this.stack.testnet : this.stack.official,
this.stack.public)
.sample()
.value()

Expand Down
1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dependencies": {
"angular": "^1.5.8",
"angular-animate": "^1.5.8",
"angular-cookies": "=1.5.8",
"angular-aria": "^1.5.8",
"angular-material": "^1.1.1",
"angular-material-data-table": "^0.10.9",
Expand Down

0 comments on commit 99c9c97

Please sign in to comment.