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

Commit

Permalink
Setup autologin from a cookie for development purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vit Stanislav authored and Vit Stanislav committed Mar 2, 2017
1 parent 6ee05fc commit 8dd7576
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 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 @@ -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
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

0 comments on commit 8dd7576

Please sign in to comment.