summaryrefslogtreecommitdiffhomepage
path: root/app/components
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-03-21 18:14:15 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-03-21 18:14:15 +0000
commitcf235a151d4f5d67f1e8e1656e831cdfbc17a22d (patch)
tree39d85d696da3c9260a7cb1974f8dbe49ac4859a8 /app/components
parentfca751a517b2b35b8316b5c1f5dab8f7a130953d (diff)
downloadmullvadvpn-cf235a151d4f5d67f1e8e1656e831cdfbc17a22d.tar.xz
mullvadvpn-cf235a151d4f5d67f1e8e1656e831cdfbc17a22d.zip
Display user out of time error
Diffstat (limited to 'app/components')
-rw-r--r--app/components/Connect.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js
index c5d435823e..8e4e400fce 100644
--- a/app/components/Connect.js
+++ b/app/components/Connect.js
@@ -1,4 +1,5 @@
import assert from 'assert';
+import moment from 'moment';
import React, { Component, PropTypes } from 'react';
import { If, Then, Else } from 'react-if';
import ReactMapboxGl, { Marker } from 'react-mapbox-gl';
@@ -49,10 +50,19 @@ export default class Connect extends Component {
render() {
let error = null;
+ // check if user out of time
+ // this is by far the simplest implementation
+ // later on backend will notify us and disconnect VPN etc..
+ if(moment(this.props.user.paidUntil).isSameOrBefore(moment())) {
+ error = new Backend.Error(Backend.ErrorType.noCredit);
+ }
+
+ // Connection error?
if(this.props.connect.status === ConnectionState.failed) {
error = this.props.connect.error;
}
+ // Offline?
if(this.props.connect.isOnline === false) {
error = new Backend.Error(Backend.ErrorType.noInternetConnection);
}