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

Setup autologin from a cookie for development purposes #40

Merged
merged 2 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -178,8 +179,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 @@ -9,6 +9,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